pittica/gatsby-plugin-blog

License Version Release GitHub package.json dependency version (dev dep on branch) GitHub package.json dependency version (dev dep on branch)

Description

Blog optimization plugin for GatsbyJS.

Install

npm

npm install @pittica/gatsby-plugin-blog

Usage

The plugin requires categories and tags fields in each header of markdown files.

Configuration

Edit your gatsby-config.js.

module.exports = {
  plugins: [
    {
      resolve: `@pittica/gatsby-plugin-blog`,
      options: {
        postsPerPage: 15,
        templateCategory: "./src/templates/category.js",
        templateTag: "./src/templates/tag.js",
        templateArticle: "./src/templates/blog-post.js",
        templateList: "./src/templates/blog-list.js",
        slug: "blog",
        regex: "/^\/(blog)\//s",
      }
    },
  ],
}

Attributes

The plugin has optional attributes.

postsPerPage

Sets the posts to display per page.

Default Value

15

templateCategory

Sets the path of the template used by categories.

templateTag

Sets the path of the template used by tags.

templateArticle

Sets the path of the template used by blog posts.

templateList

Sets the path of the template used by blog root.

regex

Sets the regular expression used to filter the slug of the posts. If not setted, the plugin uses the slug parameter.

slug

Sets the slug of the posts.

(c) 2020, Pittaca S.r.l.s.