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

Allow using :xxx_name in autopage titles (fixes #225). #240

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

solemnwarning
Copy link

No description provided.


return expand_placeholders(toFormat, {
":cat" => Jekyll::Utils.slugify(category.to_s, mode:slugify_mode, cased:slugify_cased),
":cat_name" => category_name,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line should call slugify to avoid invalid characters

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the :cat_name expansion? The whole point is to be able to return the category name without being mangled - what characters are "invalid" here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just gave this a bit of a try with the category Tes<tin>g&" and it comes out in the page as follows:

<title>Posts in category Tesg&amp;&quot; | ...</title>
<meta property="og:title" content="Posts in category Tesg&amp;&quot;" />

So quotes and ampersands are handled correctly, but anything between angle brackets is stripped out...

This is the same behaviour I get if I try putting angle brackets in a plain page title, e.g:

title: 'foo"<bar>baz'

in the page front matter comes out as:

<title>foo&quot;baz | ...</title>

An unmatched bracket in either (e.g. foo<bar) comes out correctly (foo&lt;bar).

Any idea if this is a limitation/bug within Jekyll itself? Either way, it seems to be doing the right thing.

return expand_placeholders(toFormat, {
":coll" => Jekyll::Utils.slugify(collection.to_s, mode:slugify_mode, cased:slugify_cased),
":coll_name" => collection_name,
})
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for this and other lines in this file, call slugify

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants