Skip to content

Latest commit

 

History

History
52 lines (44 loc) · 1.12 KB

add-content.md

File metadata and controls

52 lines (44 loc) · 1.12 KB

Adding Content

The steps to add new content types to this site.

Local Content

When adding a new type of local content (e.g., blogs, lists, books, etc.), the pattern to do so is the following:

  1. Add the content as a directory in ./content, e.g., ./content/blog)
  2. Add this to Gatsby in ./gatsby-config using the gatsby-source-filesystem plugin, e.g.:
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        path: `${__dirname}/content/blog`,
        name: `blog`,
      },
    },
  1. Create a new section in the .gatsby-node.js query:
blog: allMarkdownRemark(
    filter: {
    fields: {

        sourceInstance: { eq: "blog" }
    }
    }
) {
    # data you want to query
}
  1. Exclude this new sourceInstance from the final other section:
other: allMarkdownRemark(
    filter: {
        fields: {
            sourceInstance: {
            nin: [..., "notes"]
            }
        }
    }
) {
    #...
}
  1. Optional: Add a new top-level page If this type of data has it's own page, add it in src/pages
  2. Optional: Add a new layout in src/templates