Add the 'name' variable to collection permalinks #2799

Merged
merged 3 commits into from Aug 26, 2014

Conversation

Projects
None yet
3 participants
@kansaichris

It would be very helpful to have a :title attribute exposed for documents as well as pages.

@parkr Does this seem reasonable to you?

@parkr

This comment has been minimized.

Show comment
Hide comment
@parkr

parkr Aug 24, 2014

Member

I think we'll want to do a bunch of sanitation here. Additionally, it's usually name, not title, that is related to the filename. Would you please call it that?

Member

parkr commented Aug 24, 2014

I think we'll want to do a bunch of sanitation here. Additionally, it's usually name, not title, that is related to the filename. Would you please call it that?

@kansaichris

This comment has been minimized.

Show comment
Hide comment
@kansaichris

kansaichris Aug 25, 2014

I think we'll want to do a bunch of sanitation here.

Sanitation on File.basename (document.rb#L45)?

Additionally, it's usually name, not title, that is related to the filename. Would you please call it that?

Wouldn't that make Jekyll even more inconsistent than it already is? Posts appear to call this attribute title (post.rb#L218) and pages appear to call this attribute basename (page.rb#L95). Shouldn't these all be called the same thing?

(Of course, it's also entirely possible that I simply lack sufficient context. 😄)

I think we'll want to do a bunch of sanitation here.

Sanitation on File.basename (document.rb#L45)?

Additionally, it's usually name, not title, that is related to the filename. Would you please call it that?

Wouldn't that make Jekyll even more inconsistent than it already is? Posts appear to call this attribute title (post.rb#L218) and pages appear to call this attribute basename (page.rb#L95). Shouldn't these all be called the same thing?

(Of course, it's also entirely possible that I simply lack sufficient context. 😄)

@parkr

This comment has been minimized.

Show comment
Hide comment
@parkr

parkr Aug 25, 2014

Member

Sanitation on File.basename (document.rb#L45)?

We need to turn it into a slug. For a document, name could contain spaces and the like. We'd at least have to do URI.escape or something. Hence "a bunch of sanitation." 😃 Not quite sure what the best route it.

Wouldn't that make Jekyll even more inconsistent than it already is? Posts appear to call this attribute title (post.rb#L218) and pages appear to call this attribute basename (page.rb#L95). Shouldn't these all be called the same thing?

They should, yeah. I'd like them to map to Liquid variables (i.e. page.name == :name, etc). Ideally, we'd have:

  1. name == File.basename(path, ".*")
  2. title == page.title in Liquid, sluggified
Member

parkr commented Aug 25, 2014

Sanitation on File.basename (document.rb#L45)?

We need to turn it into a slug. For a document, name could contain spaces and the like. We'd at least have to do URI.escape or something. Hence "a bunch of sanitation." 😃 Not quite sure what the best route it.

Wouldn't that make Jekyll even more inconsistent than it already is? Posts appear to call this attribute title (post.rb#L218) and pages appear to call this attribute basename (page.rb#L95). Shouldn't these all be called the same thing?

They should, yeah. I'd like them to map to Liquid variables (i.e. page.name == :name, etc). Ideally, we'd have:

  1. name == File.basename(path, ".*")
  2. title == page.title in Liquid, sluggified

@kansaichris kansaichris changed the title from Add the 'title' variable to collection permalinks to Add the 'name' variable to collection permalinks Aug 26, 2014

@kansaichris

This comment has been minimized.

Show comment
Hide comment
@kansaichris

kansaichris Aug 26, 2014

Thanks for clarifying, @parkr—that makes perfect sense now. 👍

Thanks for clarifying, @parkr—that makes perfect sense now. 👍

parkr added a commit that referenced this pull request Aug 26, 2014

@parkr parkr merged commit 56cd73e into jekyll:master Aug 26, 2014

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details
@parkr

This comment has been minimized.

Show comment
Hide comment
@parkr

parkr Aug 26, 2014

Member

Brilliant work! Sorry it took so long for me to come up with the right phrasing. Merged. ☺️

Member

parkr commented Aug 26, 2014

Brilliant work! Sorry it took so long for me to come up with the right phrasing. Merged. ☺️

parkr added a commit that referenced this pull request Aug 26, 2014

@kansaichris kansaichris deleted the kansaichris:add-title-to-collection-permalinks branch Aug 26, 2014

@kansaichris

This comment has been minimized.

Show comment
Hide comment

💖

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.