close
  • English
  • Frontmatter

    You can add frontmatter at the beginning of a Markdown file. It is a YAML block wrapped with three dashes --- and used to define metadata.

    For example, use title to specify the page title. By default, Rspress uses the page's H1 heading as the HTML document title. To use a different title, set it in frontmatter:

    ---
    title: My Homepage
    ---
    
    This is my **homepage content**.

    You can also use description to specify a custom page description. By default, Rspress extracts the first contentful paragraph below the h1 heading as the description (see How description is determined). If the extracted result does not meet your needs, you can override it:

    ---
    description: A brief introduction to my homepage for SEO and social sharing.
    ---

    For example, you can use head to specify custom meta tags for Open Graph.

    ---
    head:
      - - meta
        - property: og:url
          content: https://example.com/foo/
      - - meta
        - property: og:image
          content: https://example.com/bar.jpg
    # - - [htmlTag]
    #   - [attributeName]: [attributeValue]
    #     [attributeName]: [attributeValue]
    ---
    Tip

    See Frontmatter config for available frontmatter options, and useFrontmatter for accessing frontmatter in code.