-
-
Notifications
You must be signed in to change notification settings - Fork 10
Description
Problem
I see in the following line that the content of the article is used to count the
h1 tags:
| self.content_title_analysis = ContentTitleAnalyzer(content=self._content) |
You suggest (like everyone) the following Markdown structure in your README:
Title: Page Title
Description: Page Description
# Heading Content
Nevertheless, most (all?) templates already encapsulate the "Title" metadata in an h1 tag.
This processing is independent from the rest of the article written in Markdown indeed contained in the content attribute of the objects. It is inserted as is in the html template.
Therefore such an example poses 2 problems:
- duplication of the h1 tag (that of the template + that of the article content)
- duplication not detected by the current plugin
Currently, as far as I know, the only simple way to get a compliant html page is to write articles starting the heading level at h2 via ##
although it is semantically wrong in Markdown and can disturb some plugins (table of contents rendering, etc.).
I personally use an homemade plugin to modify the final html without modifying the original Markdown.
In this case, the SEO report plugin misleads the user by not detecting any h1 title.
I would like to mention that your plugin is very welcome because it allowed me to highlight a problem that I had totally missed.
Proposal
The plugin should be refactored to read finalized pages, like the SEOEnhancer part
called after the content_written signal.
Notes
-
Pandoc has implemented an option to automatically shift the heading level :
Extension to treat first heading level as title? jgm/pandoc#5615 -
The html5 allows nesting of independent units in tags like
<section>, <article>, etc., which allows multiple h1 titles to coexist in a page (Outline algorithm). However, Mozilla is very clear about this: it is a non-standard practice and not recommended.
Cf
https://developer.mozilla.org/fr/docs/orphaned/Web/Guide/HTML/Using_HTML_sections_and_outlines#lalgorithme_outline_html5
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements#multiple_h1_elements_on_one_page -
Discussion on Hugo's side:
https://discourse.gohugo.io/t/option-to-shift-headings/6136