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

Strip html tags from the SITENAME and AUTHOR when used in the head #3147

Closed
3 tasks done
Gullumluvl opened this issue Jun 15, 2023 · 3 comments · Fixed by #3149
Closed
3 tasks done

Strip html tags from the SITENAME and AUTHOR when used in the head #3147

Gullumluvl opened this issue Jun 15, 2023 · 3 comments · Fixed by #3149

Comments

@Gullumluvl
Copy link
Contributor

  • I have searched the issues (including closed ones) and believe that this is not a duplicate.
  • I have searched the documentation and believe that my question is not covered.
  • I am willing to lend a hand to help implement this feature.

Feature Request

Hi, Pelican is great!

I wanted to give style to specific words in the SITENAME and AUTHOR, that are usually displayed at the top of the generated home page, which means adding html tags in those variables. However, this is inappropriate in the metadata and in the <title> fields of the html page (because it shows the raw text).

Specifically, my SITENAME is something like: firstname <span class="smallcaps">lastname</span>.

Is there a way to tolerate html markup in these variables, and tell Pelican or the jinja2 template to strip it away when needed?

Thanks!

@Gullumluvl
Copy link
Contributor Author

OK I got it, I'm sorry I was not familiar with the templating system.

I realize it's dependent on the template files, exclusively. Mine was using the theme "Peli-Kiera".
The simple theme also does not handle it.

So we could write this in all templates:

{{ SITENAME|striptags }}

@justinmayer
Copy link
Member

Putting HTML tags in the SITENAME and AUTHOR settings is a use case that was neither anticipated nor supported in Pelican, so I think it is up to theme maintainers to add |striptags in the appropriate places in theme templates if that is a use case they wish to support.

@Gullumluvl
Copy link
Contributor Author

Thanks. This makes sense. This pull request updates the default themes, just in case.

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

Successfully merging a pull request may close this issue.

2 participants