fabien0102 / gatsby-starter

Gatsby 2.0 starter with typescript and many cools dev tools
386 stars 99 forks source link

404 from blog tag card if tag has more than one word when generated #62

Open i001962 opened 6 years ago

i001962 commented 6 years ago

npm run generate blog post

If a tag name has a space say between two words e.g. "Probability Management" the tag card link does not include the necessary hyphen but instead tries to go to /blog/tags/Probability%20Management/ instead of /blog/tags/Probability-Management/ which was created.

No time today to hunt down a possible fix but wanted to note it here. The workaround is to hyphenate when using plop generator.

sielay commented 6 years ago

It's how the link is created in TagsCard. It should use kebabCase

const tagLink = isActive ? `/blog` : `/blog/tags/${kebabCase(tag.fieldValue)}/`;
fabien0102 commented 6 years ago

@sielay can you made a PR for this ?

sielay commented 6 years ago

Will try to do this week. Just bit busy :P

i001962 commented 6 years ago

I believe this also needs to be included in that PR. import { kebabCase } from "lodash";

sielay commented 6 years ago

Well. OFC @i001962 . Should you do one? I had no time even for such tiny one.

i001962 commented 6 years ago

@sielay I’ll do one once I figure out all the tests. I laugh a little bit when you say ofc as it wasn’t obvious to a noob like me and may not be to others who are new to react.