-
Notifications
You must be signed in to change notification settings - Fork 101
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
Allow creating slugs for emoji characters. #129
Conversation
I'd like this to be a "configurable" option instead of forcing jekyll-archives:
slug_mode: pretty # Modes supported by your Jekyll version.
# default: `nil` |
I updated the PR to read in the |
@mokhan Could you state the problem you're trying to solve here? What is the primary use case? |
I apologise for not clearly stating my problem. I updated the description. I hope this helps. |
```irb irb(main):002:0> x = "💎" => "💎" irb(main):003:0> Jekyll::Utils.slugify(x) => "" irb(main):004:0> Jekyll::Utils.slugify(x, mode: nil) => "" irb(main):005:0> Jekyll::Utils.slugify(x, mode: :pretty) => "💎" ```
It might also be useful for slugify to raise a pretty loud warning if the input was not an empty string but the output is. |
@pathawks Would that be something for Jekyll Core to do instead..? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 from me. Just a minor question regarding a test..
Yes. Sorry, I was assuming this was a Jekyll Core issue. |
@mokhan Sorry for the delay with this. The acceptable slugify modes have always been strings: SLUGIFY_MODES = %w(raw default pretty ascii latin).freeze And your implementation here presumably works in the tests because def slugify(string, mode: nil, cased: false)
mode ||= "default"
return nil if string.nil?
unless SLUGIFY_MODES.include?(mode)
return cased ? string : string.downcase
end
...
end Therefore, I'll keep this PR open for a week more for you to revisit. (You are free to close this voluntarily, if you don't want to pursue this any more). |
Yes. This is still a problem:
If people want to generate a unique slug, this MR allows them to inject a custom slug mode.
Agreed. I can remove the call to |
Back to you @ashmaroli. 🏓 |
Thank you @mokhan |
I would like to be able to generate archives for categories identified by an emoji character.
For example:
https://www.mokhan.ca/ls/💎/
The current version of this gem replaces the emoji character with a blank string:
This behaviour causes the generation of archives in the root of the
category
permalink. i.e/:category/
instead of/:category/💎/
.My proposed solution adds a new configuration named
slug_mode
that allows jekyll users to change how slugs are generated. The:raw
slug mode preserves the emoji character instead of replacing it with a blank string.