begin blog implementation

This commit is contained in:
neri 2020-02-19 00:00:11 +01:00
parent 7e6cbc9b29
commit 1c779d2110
3 changed files with 29 additions and 2 deletions

7
blog/test-entry.md Normal file
View File

@ -0,0 +1,7 @@
---
title: Test Entry
date: '1970-01-01T22:45:00-01:00'
description: 'testing the log posts'
---
# This is a test

View File

@ -14,6 +14,13 @@ module.exports = {
path: `${__dirname}/src/pages`, path: `${__dirname}/src/pages`,
}, },
}, },
{
resolve: `gatsby-source-filesystem`,
options: {
name: `blog`,
path: `${__dirname}/blog`,
},
},
{ {
resolve: `gatsby-plugin-mdx`, resolve: `gatsby-plugin-mdx`,
options: { options: {

View File

@ -7,7 +7,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
const result = await graphql(` const result = await graphql(`
{ {
allMdx(limit: 1000) { allMdx(limit: 1000, filter: { fields: { source: { eq: "pages" } } }) {
edges { edges {
node { node {
frontmatter { frontmatter {
@ -36,6 +36,19 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
}) })
} }
exports.onCreateNode = ({ node, getNode, actions }) => {
const { createNodeField } = actions
if (node.internal.type === `Mdx`) {
const value = getNode(node.parent).sourceInstanceName
createNodeField({
node,
name: `source`,
value,
})
}
}
exports.createSchemaCustomization = ({ actions }) => { exports.createSchemaCustomization = ({ actions }) => {
const { createTypes } = actions const { createTypes } = actions
const typeDefs = ` const typeDefs = `