vls's picture

Hi. I am experimenting with creating a Backdrop theme from scratch.

The front/home page wraps the site name in a <h1> element

  <h1 class="site-name">

but sub-pages wrap it in <div> element

  <div class="site-name">

Causing the site name on the front page, prior to adding any styling, to render larger and spaced down in the header compared to sub-pages.

It does not seem to matter which layout I choose.
Is this intentional?
If so, why? It seems like it should be consistent site wide.
 

Accepted answer

In my opinion this is done intentionally and is valid for most Drupal themes that I have worked with. I guess the reason is this:

When you open front page and it contains a list of posts, their headings are H2 but the site is H1. When you open another page in the site, its title becomes H1, and the site name ceases to be H1.

This was important for HTML4 where there should be only one H1 on page. In HTML 5 each section can have a standalone H1 and this behavior should be reconsidered according to the appropriateness for the case and the site.

I've overcome sometimes this by removing the site-name in the header code at all and inserting it with custom block in header region -  then the same code is displayed on all pages and the site name is always H1.

Useful tool for analyzing the structure of the titles in the site is this plugin for Firefox.

https://addons.mozilla.org/en-US/firefox/addon/headingsmap/?src=search

 

 

 

Comments

Yes, that's odd.

Bartik is a pretty old theme from Drupal 7 core. It still exists in Backdrop to help with people who are migrating from existing Drupal 7 sites and prefer to keep using it. But it's not a great theme to use for new sites. You're probably better off either making a child theme of Basis, starting fresh or use another theme.

vls's picture

Thanks for the response herb but I think you misread my posting.  This is not with Bartik.  This issue is when starting fresh. 

amilenkov's picture

In my opinion this is done intentionally and is valid for most Drupal themes that I have worked with. I guess the reason is this:

When you open front page and it contains a list of posts, their headings are H2 but the site is H1. When you open another page in the site, its title becomes H1, and the site name ceases to be H1.

This was important for HTML4 where there should be only one H1 on page. In HTML 5 each section can have a standalone H1 and this behavior should be reconsidered according to the appropriateness for the case and the site.

I've overcome sometimes this by removing the site-name in the header code at all and inserting it with custom block in header region -  then the same code is displayed on all pages and the site name is always H1.

Useful tool for analyzing the structure of the titles in the site is this plugin for Firefox.

https://addons.mozilla.org/en-US/firefox/addon/headingsmap/?src=search