-
Notifications
You must be signed in to change notification settings - Fork 9
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
About SEO report and h1 tags #55
Comments
Hi @ysard and thanks for your report. From a SEO point of view, template creators should never encapsulate title in a h1 tag. Website creators should be able to customize page title and content title as they want, and thus respect the Markdown semantic (# ## ###...). So I think this is an issue that should be addressed to template creators.
I'm not sure to understand what would it change. In the case you pointed, the plugin works on HTML elements (
|
To clarify the discussion, let's take the example of a template commonly accepted as flawless: On the subject of interest, here is the usage of the title metadata of a pelican article: The content of the article stricto-sensu is displayed below: Two options from here:
But I'm digressing because as you mention, this is a matter for both the template creator and the article writer. That said, in any case the SEO Report plugin only counts This is why I point out that |
Ok, got it, you're right. Moreover, on the template you link, even without considering the structure of article content on Markdown/Rest, there is already two When the plugin will be updated, the SEO report will surely be red for From what I quickly tested and as you suggested, the Do you want to do the modifications? If not, I will wait for the merge of your current PR before working on this, as it will surely conflict with your PR. |
Problem
I see in the following line that the content of the article is used to count the
h1 tags:
seo/pelican/plugins/seo/seo_report/seo_analyzer/__init__.py
Line 22 in 5ab4c64
You suggest (like everyone) the following Markdown structure in your README:
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
The text was updated successfully, but these errors were encountered: