gatsby-starter icon indicating copy to clipboard operation
gatsby-starter copied to clipboard

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

Open i001962 opened this issue 7 years ago • 6 comments

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.

i001962 avatar Apr 30 '18 23:04 i001962

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

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

sielay avatar May 17 '18 13:05 sielay

@sielay can you made a PR for this ?

fabien0102 avatar May 17 '18 14:05 fabien0102

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

sielay avatar May 17 '18 14:05 sielay

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

i001962 avatar Aug 31 '18 19:08 i001962

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

sielay avatar Sep 03 '18 08:09 sielay

@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.

i001962 avatar Sep 03 '18 16:09 i001962