Skip to content

Latest commit

 

History

History

title-to-frontmatter

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Gatsby Remark title to frontmatter

This package is a Gatsby module to move the title from the Markdown content to the frontmatter object.

This give the developer access to the title property to place it anywhere inside the page layout the way he want.

It supports CommonJS and ES modules.

It searches for the first heading of level 1 and create two frontmatter properties, title and titleHTML.

The title property is a text version cleaned from any HTML syntax.

Usage

Install the package:

npm install gatsby-remark-title-to-frontmatter

Open your gatsby-config.js file and register the plugin:

export default {
  siteMetadata: {
    title: "Gatsby website",
  },
  plugins: [
    {
      // Gatsby plugins registration goes here
    },
    {
      resolve: `gatsby-transformer-remark`,
      options: {
        // Remark configuration goes here
        plugins: [
          {
            resolve: "gatsby-remark-title-to-frontmatter",
            options: {
              include: [
                "**/*.md", // an include glob to match against
              ],
            },
          },
        ],
      },
    },
  ],
};