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

Use markdownify for title? #179

Closed
Syralist opened this issue May 26, 2020 · 2 comments
Closed

Use markdownify for title? #179

Syralist opened this issue May 26, 2020 · 2 comments
Labels
enhancement New feature or request feature request
Milestone

Comments

@Syralist
Copy link
Contributor

I want to use ndashes in my page titles. In the content of the post a double hyphen -- is automatically converted by markdownify. Since titles are not processed through markdownify the double hyphen is preserved.
Is there a reason not to apply markdownify to titles? If there is not I will open a pull-request with my suggested changes. :)

@palant
Copy link
Collaborator

palant commented May 27, 2020

The main reason should be that titles will be used in a bunch of places expecting plain text, e.g. the page's <title> tag. And while Hugo's plainify function can strip out HTML tags, it won't turn HTML entities into their plain text equivalent. So you'll end up with &ndash; displayed as text in the page title...

@palant
Copy link
Collaborator

palant commented May 27, 2020

Then again, $title | plainify | htmlUnescape will take care of those HTML entities as well. So I guess that this could be done.

@reuixiy reuixiy added enhancement New feature or request feature request labels May 28, 2020
@reuixiy reuixiy added this to the v4.5.0 milestone May 30, 2020
@reuixiy reuixiy closed this as completed in 1322fdd Jun 2, 2020
ulmefors pushed a commit to ulmefors/hugo-theme-meme that referenced this issue Nov 22, 2020
closes reuixiy#179

* First approach to markdownify title

* refactor: use title.html

* apply htmlUnescpae to title and rawTitle

Co-authored-by: reuixiy <reuixiy@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature request
Projects
None yet
Development

No branches or pull requests

3 participants