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

[Permalink] Using the document's actual title instead of the its file name #4012

Closed
wsmd opened this issue Oct 6, 2015 · 3 comments
Closed

Comments

@wsmd
Copy link

wsmd commented Oct 6, 2015

Say I have this document named 2015-10-06-dont-show-this.md

and in in its front matter I have this title

---
title: this is the actual title

---

I've set the permalink in my _config.yml to :categories/:title and I understand that the documentation clearly states:

title => Title from the document’s filename. May be overridden via the document’s slug YAML front matter.

So, when the site renders, of course the link to the page will be:

http://link.to.site/category/dont-show-this

Is there any way I can use the article's actual title in the link? So it would be:

http://link.to.site/category/this-is-the-actual-title

Maybe something like auto slugging the actual title?

@mattr-
Copy link
Member

mattr- commented Oct 6, 2015

I believe your answer is "hidden" in the docs you posted.

title => Title from the document’s filename. May be overridden via the document’s slug YAML front matter.

You'll need a piece of front matter named slug with the slug you actually want the post to have.

@wsmd
Copy link
Author

wsmd commented Oct 7, 2015

@mattr- That's right. But I'm looking for an "automatic" way to do it without having to enter the slug manually. Simply put, Jekyll should use the title (front matter) of the article and automatically creates an a slug from it.

@parkr
Copy link
Member

parkr commented Nov 18, 2015

The filename will always need a slug. title from your front matter cannot be used in the slug at this point. :title will always be the filename slug, at least at the time of this writing (v3.0.1).

title: Utils.slugify(data['slug'], mode: "pretty", cased: true) || Utils
.slugify(basename_without_ext, mode: "pretty", cased: true),
slug: Utils.slugify(data['slug']) || Utils.slugify(basename_without_ext),

Changing this would cause lots of issues, so I'm going to mark this as "Won't Fix."

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