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
Fix casing in :title
and add :slug
for automatic downcasing in URLs
#4100
Conversation
I'm on the fence with this, I don't know if the rest of @jekyll/core will be but surely to me a slug is the one that is normalized, so this is the flip of that. I would much rather slug to be something like "cased_title" or something to that effect. |
Actually the word
we are naming the variable as @envygeeks your suggestion is great, |
What is most backwards-compatible? I thought |
In theory if I were programming an app (a blog) that was in Rails or Lotus slug would be the one that downcases, normalizes and transforms and title would be the one that keeps case and does the minimal of normalizing to ensure that a path doesn't break. |
What did Jekyll do before, though? That's what I'm asking. It sounds like 3.0 changed this behaviour, and I'm not sure it did it for any good reason other than my own laziness or bad testing. |
|
Ok so let's make |
In old version Jekyll, we haven't moved
while in
But at that time, we don't even have I'll update my pr ASAP. |
I've updated my pr to make |
That's a pretty complete pull request. I'm |
@envygeeks it's done. Can't wait to see this commit gets merged. |
@parkr does this PR look good to you? |
Hey @envygeeks @parkr I have the same issue when I build my site with the latest version Jekyll 3.0, and all my links are broken, please merge this pr as soon as possible to solve my problem, thx. Zhe Li |
@@ -186,7 +186,8 @@ def url_placeholders | |||
path: cleaned_relative_path, | |||
output_ext: output_ext, | |||
name: Utils.slugify(basename_without_ext), | |||
title: Utils.slugify(data['slug']) || Utils.slugify(basename_without_ext), | |||
title: Utils.slugify_cased(data['slug']) || Utils.slugify_cased(basename_without_ext), |
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.
should this be slugify(data['slug'], cased: true)
perchance?
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.
we can change the api later, i guess.
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.
@parkr named parameter is a better solution, thanks for advice!
BTW, you may want to take a look at issue #4135 , users are complaining about their underscore are replaced by hyphen, maybe someday users would say they want their ~
back. Should we use Pretty
mode here for :title
, seems Pretty mode [^[:alnum:]._~!$&'()+,;=@]+
is designed to handle this kind of issue.
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.
Yeah that sounds good.
4f59349
to
fec9a37
Compare
@parkr such a silly mistake :( . Fixed now. |
|
^^ agreed! |
Hi, I used my I agree to the direction of change, making |
See jekyll/jekyll#4100 for details.
@yous Actually if you are upgrading Jekyll from 2.x to 3.0.1, you will not notice any breaking change. From my perspective, 3.0.1 is like a quick turnaround for some 3.0.0 unplanned breaking change. BTW, instread of just making title pretty, I add slug for anyone who wants to keep up with Jekyll slugify trend. You got the chance to make everything correct, right? People in community are trying to make slugify customizable, you might be interested. |
@rebornix Oops, I hadn't noticed the change when I upgrade Jekyll 2.x to 3.0.0.pre.x. Well... it seems I need more tests. Thanks for pointing it out! |
If it's not noted in our upgrading docs that @parkr just released please file a ticket so we can update those docs to mention that. |
slug
to document url_placeholders.:title
and add :slug
for automatic downcasing in URLs
Use :slug instead of :title in permalinks. See jekyll/jekyll#4100
The only difference between
slug
andtitle
is that uppercase letters are not converted to their lowercase counterparts inslug
. After adding this property, the final permalink of_posts/2015-10-27-Jekyll.md
with permalink style/:year/:month/:day/:slug
will be/2015/10/27/Jekyll/
.This pr is related to issue #4072 and it's my first time writing ruby, correct me if I made anything wrong.