mirror of
https://github.com/silverstripe/doc.silverstripe.org
synced 2024-10-22 15:05:50 +00:00
html fallback when watchFile null
This commit is contained in:
parent
63833a4f28
commit
856d707efa
@ -7,7 +7,12 @@ import { setCurrentNode } from '../utils/nodes';
|
||||
|
||||
const Template: StatelessComponent<SingleFileQuery> = (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
|
||||
|
@ -11,6 +11,7 @@ export interface SinglePage {
|
||||
html: string;
|
||||
}
|
||||
parent: {
|
||||
html: string;
|
||||
parent: {
|
||||
relativePath: string;
|
||||
gitRemote: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user