You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I work on a custom Pelican template, inspired by the "notmyidea" theme and only partially derived from the "simple" theme suggested in the documentation. The blog is styled in a font that resembles LaTeX, which makes one problem particularly irritating:
Header levels in blog entry list
When you write and render an article cleanly, the header levels go from h1 (#) ➜ h2 (##) ➜ h3 (###) ➜ etc., while h1 typically represents the article title at the very top. This works well when the article is displayed in its entirety (article.html), e.g.
But on the blog entry list page (index.html) each article's title is rendered as a link with an h2-level header. This is followed by the article.summary that already contains content with h2-level headers, and we get an irritating effect.
Note how the content's h2-level header looks like another header, which appears to have been forgotten to link to an article.
Solution approaches
The simple theme works around this issue by simply not using h1 at all for article content (see article.html).
A proper way to fix this issue otherwise would be to "demote" all header levels in the article.summary, i.e. replace all <h3> tags by <h4>, all <h2> tags by <h3> all <h1> tags by <h2> (including their closing tags, apparently). Does anyone know about an already existing filter for Jinja2 somewhere?
Is there any other elegant way how this can be fixed?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I work on a custom Pelican template, inspired by the "notmyidea" theme and only partially derived from the "simple" theme suggested in the documentation. The blog is styled in a font that resembles LaTeX, which makes one problem particularly irritating:
Header levels in blog entry list
When you write and render an article cleanly, the header levels go from
h1(#) ➜h2(##) ➜h3(###) ➜ etc., whileh1typically represents the article title at the very top. This works well when the article is displayed in its entirety (article.html), e.g.But on the blog entry list page (
index.html) each article's title is rendered as a link with anh2-level header. This is followed by thearticle.summarythat already contains content withh2-level headers, and we get an irritating effect.Note how the content's
h2-level header looks like another header, which appears to have been forgotten to link to an article.Solution approaches
The simple theme works around this issue by simply not using
h1at all for article content (see article.html).A proper way to fix this issue otherwise would be to "demote" all header levels in the
article.summary, i.e. replace all<h3>tags by<h4>, all<h2>tags by<h3>all<h1>tags by<h2>(including their closing tags, apparently). Does anyone know about an already existing filter for Jinja2 somewhere?Is there any other elegant way how this can be fixed?
Beta Was this translation helpful? Give feedback.
All reactions