Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove leading and trailing hyphens from slugs to match jekyll behavior #56

Merged
merged 1 commit into from
Dec 6, 2023

Conversation

sirwart
Copy link
Contributor

@sirwart sirwart commented Dec 6, 2023

When I tried to use gojekyll with my blog, a post that had a question mark at the end had the wrong slug and therefore links` to the post broke. This was due to the fact that jekyll will strip leading and trailing hyphens after it replaces non-alphanumeric with hyphens. You can see this behavior here:

https://github.com/jekyll/jekyll/blob/646b4241669ac54247d8bf1ce3e4c616ac71d9fe/lib/jekyll/utils.rb#L219

To fix this, I added similar behavior to the Slugify function in gojekyll, and after that my site built with the correct routes.

Checklist

  • I have read the contribution guidelines.
  • make test passes.
  • make lint passes.
  • New and changed code is covered by tests.
  • Performance improvements include benchmarks.
  • Changes match the documented (not just the implemented) behavior of Jekyll.

@danog
Copy link
Collaborator

danog commented Dec 6, 2023

Thanks!

@danog danog merged commit f1794a8 into osteele:main Dec 6, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants