Frontmatter

Required frontmatter

The following items are the minimum required frontmatter fields.

title

String or Limited Markdown. The page title.

title: The importance of being earnest

pubDate

Date. YYYY-MM-DD. The date the page was first published. See also: modDate. This is used for sorting some types of content.

pubDate: 2022-10-01

description

String. Used for the meta description and in the site search.

description: An overview of frontmatter in Astro Accelerator.

Optional frontmatter

layout

String. Specifies the layout for the page. Defaults to src/layouts/Default.astro if missing.

layout: src/layouts/Default.astro

subtitle

String or Limited Markdown. A subtitle for the page.

subtitle: A play by Oscar Wilde.

keywords

String. Allows you to specify the meta keywords value.

keywords: astro,frontmatter

summary

String or Limited Markdown. A summary of an item.

summary: >-
    A summary can contain a description with _markdown_.

    This content is often used at the top of list pages, for example, to describe an author.

    YAML requires this content to be indented.

modDate

Date. YYYY-MM-DD. The date the content was last changed. This is used to indicate updates via the sitemap and to broadcast a change has been made.

modDate: 2022-10-01

categories

String list. A list of categories to assign to the page. All categories are shown in default taxonomy components.

categories:
    - Astro
    - Websites

tags

String list. A list of tags to assign to the page. The most used tags are shown in default taxonomy components.

tags:
    - JavaScript
    - TypeScript

meta

List of meta tags with name and content.

meta:
    - name: canonical
      content: https://example.com/your-canonical-url
    - name: theme-color
      content: #222255

Shorthand meta tags

Note: Use the shorthand frontmatter entries, not the meta entry, to specify:

Overriding automatic meta tags

If you use one of the meta tags that is usually automated, it will be replaced with the meta tag defined on the page:

  • canonical: Usually the current page URL
  • format-detection: Usually telephone=no
  • theme-color: Usually the value in global themeColor in config.ts
  • viewport: Usually width=device-width, initial-scale=1, minimum-scale=1

Non-overridable meta tags

  • The meta charset tag is always utf-8
  • Open graph tags shouldn’t be changed using meta frontmatter

id

String. Needed for author profiles. Must be unique.

id: steve-fenton

String list. The authors of the content. Uses author ids.

authors:
    - steve-fenton

String. A short title to be used in navigation menus. Only needed where the menu should use different text to title.

navTitle: Short title

String. A short title to be used for navigation groups, if it needs to be different from navTitle or title.

navSection: Docs

Number. Recommended where the order of pages in navigation is important.

navOrder: 1000

bannerImage

An image to use in open graph banners, which are used when your page is shared on social networks and other platforms.

bannerImage:
    src: '/img/reading.png'
    alt: A person holding a book

dir

ltr or rtl. Sets the direction of the content, for example rtl would be used for Arabic content.

dir: rtl

lang

String. Sets the language of the content, used to select translations from language.json for common components.

lang: en-GB

paged

Bool. Signals that pages will be generated, which means navigation links will be updated to point to the first page.

paged: true

Bool. Can be used to remove the page from the site search.

navSearch: false

Bool. Can be used to remove the page from the site map.

navSitemap: false

Bool. Can be used to remove the page from the menu.

navMenu: false

redirect

String. When used with a redirection layout (for example src/layouts/Redirect.astro) this specifies the relative or fully qualified address to redirect the user to.

redirect: https://www.stevefenton.co.uk/

robots

String. Allows control over indexability. By default index, follow is used, so only set this when you don’t want the default.

robots: noindex, follow

Limited Markdown

Limited Markdown refers to subset of markdown allowing paragraphs and block quotes with inline styling with *emphasis*, **strong**, ~strikeout~, and line breaks\.

Please open a GitHub issue to discuss extending this feature, which is limited to improve performance on large sites.