Skip to content
This repository has been archived by the owner on Jul 24, 2023. It is now read-only.

Latest commit

 

History

History

gatsby-remark-lang-slug

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

gatsby-remark-lang-slug

It's almost the same as gatsby-remark-slug yet it uses speakingurl instead of github-slugger for proper slugs on pages in languages other than English.

Installation

yarn add -D gatsby-remark-lang-slug
# or
npm i -D gatsby-remark-lang-slug
// gatsby-config.js
{
  resolve: `gatsby-plugin-mdx`,
  options: {
    gatsbyRemarkPlugins: [
      `gatsby-remark-lang-slug`,
    ]
  }
}

Usage

It expects the language to be set as node field lang using createNodeField in onCreateNode hook.

// gatsby-node.js
exports.onCreateNode = ({ node, actions: { createNodeField } }) => {
  createNodeField({
    node,
    name: `lang`,
    value: `de`,
  })
}

It'll default to en (English) if no lang has been set.

Supported languages

Please check out speakingurl's list of supported languages

Ideas

Maybe add support for custom id's like ### My Great Heading {#custom-id} as remark-heading-id does