Skip to content

Set meta description per-page #393

Open
@avivace

Description

@avivace

Currently, the description meta tag is set to a site-wide value, on every single exported HTML page:

<meta name="description" content="The single, most comprehensive technical reference to Game Boy available to the public.">

We need a proper couple of sentences, different for each page, to actually showcase what the page is about.

A couple of possible solutions:

  • Set description manually, per-page. This is the best as we can prepare curated "extracts". I'd like to be able to set it per-markdown file, maybe in a YAML front matter. See https://docs.rs/mdbook-frontmatter/0.0.4/mdbook_frontmatter/ can be useful
  • Unstrip the {{{ content }}} value of the HTML, ignore the headers and consider the first N (30, 40?) characters. Maybe even try to detect the first M (2, 3?) sentences.

Example of a Twitter generated card for a page in Pan Docs after this modifications:

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestfrontendCSS Style, UI components, UX, typography

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions