diff --git a/gatsby-node.js b/gatsby-node.js index 9eb81e796..406717cb2 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -8,6 +8,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => { allMdx(limit: 1000) { edges { node { + fileAbsolutePath frontmatter { path template @@ -28,7 +29,12 @@ exports.createPages = async ({ actions, graphql, reporter }) => { createPage({ path: node.frontmatter.path, component: path.resolve(`src/templates/${node.frontmatter.template}.js`), - context: {}, // additional data can be passed via context + context: { + fileRelativePath: node.fileAbsolutePath.replace( + `${process.cwd()}/`, + '' + ), + }, }); }); }; diff --git a/src/components/Footer.js b/src/components/Footer.js index 55ff26683..01af3d44d 100644 --- a/src/components/Footer.js +++ b/src/components/Footer.js @@ -7,7 +7,9 @@ import FeatherIcon from './FeatherIcon'; import Logo from './Logo'; import PropTypes from 'prop-types'; -const Footer = ({ className }) => ( +const githubBaseUrl = 'https://github.com/newrelic/developer-website'; + +const Footer = ({ className, fileRelativePath }) => (