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

Consider adding a new permalink style with original title name (no downcase) #4072

Closed
rebornix opened this issue Oct 29, 2015 · 4 comments
Closed

Comments

@rebornix
Copy link
Contributor

After upgrading my website from 2.5 to 3.0, :title in permalinks will be converted to lower case. All my website page links change slightly, for instance, from /2015/10/27/NewPost/ to /2015/10/27/newpost/. It's a minor change, but all the links I used in other websites are broken totally.

As all permalink style are using the lower case :title, there is no backwards compability or any flexibility. Can we have another permalink style to use the original title from file name?

@parkr
Copy link
Member

parkr commented Oct 30, 2015

Seems like a regression to me. Does this affect only posts for you, or for all documents/pages/posts?

@rebornix
Copy link
Contributor Author

It only affects posts, documents and pages are okay. I went through the code base roughly, it maybe not an easy fix. The code is using Utils.slugify to generate post file's metadata permalink or title in pre-process phase

  string.
        # Strip according to the mode
        gsub(re, '-').
        # Remove leading/trailing hyphen
        gsub(/^\-|\-$/i, '').
        # Downcase
        downcase 

When we finally generate the permalink per Permalink Style configuration

def add_permalink_suffix(template, permalink_style)
      case permalink_style
      when :pretty
        template << "/"
      when :date, :ordinal, :none
        template << ":output_ext"
      else
        template << "/" if permalink_style.to_s.end_with?("/")
        template << ":output_ext" if permalink_style.to_s.end_with?(":output_ext")
      end
      template
    end

The permalink is already finalized. We can't easily pass any optional parameter to determine whether to lowercase the title.

I'm not a ruby guy, correct me if I'm wrong.

@rebornix
Copy link
Contributor Author

BTW, there is a workaround for this issue: add permalink "/2015/10/31/UpperCase.html" in post's yaml front matter. But I have to update all my posts.

It's Okay with me that there's some breaking change in 3.0, if you think lowercase title is a must in 3.x, maybe provide users a migration tool to help workaround these breaking changes.

@parkr
Copy link
Member

parkr commented Nov 18, 2015

In 3.0.1, :title will be what it used to be.

@parkr parkr closed this as completed Nov 18, 2015
@parkr parkr added this to the 3.0.1 milestone Nov 18, 2015
@jekyll jekyll locked and limited conversation to collaborators Feb 27, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants