diff --git a/src/templates/docs-template.tsx b/src/templates/docs-template.tsx index 7429668..725a010 100644 --- a/src/templates/docs-template.tsx +++ b/src/templates/docs-template.tsx @@ -7,7 +7,12 @@ import { setCurrentNode } from '../utils/nodes'; const Template: StatelessComponent = (result): ReactElement => { const currentNode = result.data.silverstripeDocument; - const { html } = currentNode.watchFile; + let html; + if (currentNode.watchFile) { + html = currentNode.watchFile.html; + } else { + html = currentNode.parent.html; + } const { title, slug } = currentNode; const { relativePath, gitRemote: { ref, webLink } } = currentNode.parent.parent; const editLink = `${webLink}/edit/${ref}/${relativePath}`; @@ -43,6 +48,7 @@ export const pageQuery = graphql` } parent { ... on MarkdownRemark { + html parent { ... on File { relativePath diff --git a/src/types/index.ts b/src/types/index.ts index 4ea1323..1e0881a 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -11,6 +11,7 @@ export interface SinglePage { html: string; } parent: { + html: string; parent: { relativePath: string; gitRemote: {