I have a question concerning the title tag. On some content, I’m using Markdown in titles, like italics for the name of a book or a movie.
When this title is displayed on the page, I want to markdownify it to have HTML output. But in the header, I want to have only the content as text, without Markdown or HTML markup.
What I do is to add an additional title, say main_title, and use markdown with line feeds etc. in that one. In one site I even have both a main_title and lead_title. Then I use the regular .Title in head.
I remember now that I had stumble upon the same problem last summer, and I wanted to use a Go function, which was not possible…
I’m working on a new project where I could duplicate every title, but if I wanted to transfer my main blog on Hugo, it would be impossible (more than 1100 articles to deal with…).
So I guess there is really no solution right now. Maybe I should create a GitHub issue asking for this ? I can’t be the only one on Earth who use HTML in titles… or am I ?
I do, and it works fine for me. Creating a one time script that duplicates the title into a custom_title element for your 1000+ posts sounds like a one liner in bash or Perl or whatever. We could introduce a plain_title or something, but in my head it clutters more than it really solves things …
The one argument for it would be to get some common theme support for it … But then I would rather have a method that:
I think, what should be added is a markdownify-like function that output plain text, no matter what. Wouldn’t it be useful ?
It’s not the existing posts that bothers me, but also the next. If I have to fill two different parameters each time… It’s not impossible, but it’s (relatively) painful.
Anyway, for now, I’m going to duplicate title, but I still think it would be great to have this, if nothing else for the HTML title that accepts only plain text.