diff --git a/gatsby-node.js b/gatsby-node.js
index cf7e593c1..c63b83cd5 100644
--- a/gatsby-node.js
+++ b/gatsby-node.js
@@ -1,4 +1,5 @@
const path = require(`path`);
+const { execSync } = require('child_process');
const getFileRelativePath = (absolutePath) =>
absolutePath.replace(`${process.cwd()}/`, '');
@@ -59,6 +60,17 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
exports.onCreateNode = ({ node, actions }) => {
// if we don't have a relative path, attempt to get one
+ if (node.internal.type === 'Mdx' && node.fileAbsolutePath) {
+ const gitAuthorTime = execSync(
+ `git log -1 --pretty=format:%aI ${node.fileAbsolutePath}`
+ ).toString();
+ actions.createNodeField({
+ node,
+ name: 'gitAuthorTime',
+ value: gitAuthorTime,
+ });
+ }
+
if (node.context && !node.context.fileRelativePath) {
const { createPage } = actions;
const { path, component } = node;
diff --git a/src/templates/GuideTemplate.js b/src/templates/GuideTemplate.js
index 75d273bc5..cbcfcba64 100644
--- a/src/templates/GuideTemplate.js
+++ b/src/templates/GuideTemplate.js
@@ -11,7 +11,7 @@ import styles from './GuideTemplate.module.scss';
const GuideTemplate = ({ data }) => {
const { mdx } = data;
- const { frontmatter, body, parent } = mdx;
+ const { frontmatter, body, fields } = mdx;
const { title, description, duration } = frontmatter;
return (
@@ -28,7 +28,7 @@ const GuideTemplate = ({ data }) => {