Skip to content

Bad SEO scores for H1 in Hero section #4453

@simonihmig

Description

@simonihmig

Describe the bug

The Hero interface docs say:

// The main text for the hero section. This will be defined
// as h1 tag.
text: string

However, this is not what it is doing. Instead it is rendering Hero.name as <h1>, and Hero.text is just a plain <p>. This leads to bad SEO scores (e.g. in SEO checkers), due to name being too short, often just a single word (the "product" name).

Reproduction

Check DOM output in any VitePress site using the default theme, e.g. https://vitepress.dev/:

document.querySelector('h1').innerText; // evaluates to 'VitePress'

Expected behavior

h1 should include Hero.text as documented.

I think ideally it could wrap around both name and text (without changing any existing styling), maybe with a visually hidden dash separating them, so for SEO and a11y the h1 of e.g. vitepress.dev would be "VitePress - Vite & Vue Powered Static Site Generator".

System Info

n/a

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    themeRelated to the theme

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions