Blog optimization plugin for GatsbyJS.
npm install @pittica/gatsby-plugin-blog
The plugin requires categories and tags fields in each header of markdown files.
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",
}
},
],
}
The plugin has optional attributes.
Sets the posts to display per page.
15
Sets the path of the template used by categories.
Sets the path of the template used by tags.
Sets the path of the template used by blog posts.
Sets the path of the template used by blog root.
Sets the regular expression used to filter the slug of the posts. If not setted, the plugin uses the slug parameter.
Sets the slug of the posts.
(c) 2020, Pittica S.r.l.s..