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

Site Title block: do not force h1 on all pages #20333

Closed
nickcernis opened this issue Feb 20, 2020 · 3 comments · Fixed by #20361
Closed

Site Title block: do not force h1 on all pages #20333

nickcernis opened this issue Feb 20, 2020 · 3 comments · Fixed by #20361
Assignees
Labels
[Feature] Blocks Overall functionality of blocks [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.

Comments

@nickcernis
Copy link
Contributor

Is your feature request related to a problem? Please describe.
The site-title block currently uses an h1 element at all times:

return sprintf( '<h1>%s</h1>', get_bloginfo( 'name' ) );

Subpages and archives will wrap the site title in an h1 as a result. This is less good for accessibility and SEO, because the site title is not normally the most important title on those pages — the page/post/archive title is.

Popular themes typically use h1 only if ( is_front_page() || is_home() ) && ! is_page(), and a div or p at other times.

From Twenty Twenty:

		'home_wrap'   => '<h1 class="%1$s">%2$s</h1>',
		'single_wrap' => '<div class="%1$s faux-heading">%2$s</div>',
		'condition'   => ( is_front_page() || is_home() ) && ! is_page(),

Genesis does something similar, but lets users choose whether to use h1 or p on the homepage, defaulting to h1 for “latest posts” and p for static pages.

Describe the solution you'd like
Should WP behave like Twenty Twenty, Genesis, and others instead of forcing an h1 everywhere and placing the burden on theme developers to adjust it?

Users could still filter the result if they wish, but it would be more optimal by default.

Describe alternatives you've considered
Users who care about accessibility and SEO will need to filter site-title block output or use a theme or SEO plugin that handles this for them.

@youknowriad
Copy link
Contributor

Sounds legit to me, we should be able to choose the level and sometimes even show the site title at multiple places in the same page.

@youknowriad youknowriad added [Feature] Blocks Overall functionality of blocks [Feature] Full Site Editing [Type] Enhancement A suggestion for improvement. labels Feb 20, 2020
@mtias
Copy link
Member

mtias commented Feb 20, 2020

@youknowriad this to me would be another point towards making this block a variation of Heading, so you get access to any h-level (with h1 as the default, perhaps), color support, document outline support (for invalid heading), etc.

@nickcernis
Copy link
Contributor Author

nickcernis commented Feb 20, 2020

@youknowriad this to me would be another point towards making this block a variation of Heading, so you get access to any h-level (with h1 as the default, perhaps), color support, document outline support (for invalid heading), etc.

@mtias Perhaps the default should be p/div if we go this route? That way, it's correct for most use cases (subpages), and users only have to override it on their homepage (to set an h1 there if they choose). Otherwise we're asking users to change from h1 to p on every post and page they create.

There may also be a case to leave the site title block as a separate block instead of a variation if we decide to add other block properties to it, such as the option for logo output: #1851 (comment) (And also because we need a p/div option for the site title instead of just h1-h6.)

@epiqueras epiqueras self-assigned this Feb 21, 2020
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Feb 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Blocks Overall functionality of blocks [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants