Skip to content

Commit 9b7c3c9

Browse files
conditional handling for context plugin layouts merging
1 parent 91ddd64 commit 9b7c3c9

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

packages/cli/src/lib/layout-utils.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,10 +276,20 @@ async function getPageLayout(pageContents, compilation, matchingRoute, ssrLayout
276276
layoutContents = ssrLayout;
277277
} else if (layout && (customPluginPageLayouts.length > 0 || hasCustomStaticLayout)) {
278278
// has a custom layout from markdown frontmatter or context plugin
279-
layoutContents =
279+
const contents =
280280
customPluginPageLayouts.length > 0
281-
? await fs.readFile(new URL(`./${layout}.html`, customPluginPageLayouts[0]), "utf-8")
281+
? await fs.readFile(customPluginPageLayouts[0], "utf-8")
282282
: await fs.readFile(new URL(`./${layout}.html`, userLayoutsDir), "utf-8");
283+
284+
if (pageContents) {
285+
layoutContents = contents;
286+
} else {
287+
pageContents = contents;
288+
}
289+
// layoutContents =
290+
// customPluginPageLayouts.length > 0
291+
// ? await fs.readFile(new URL(`./${layout}.html`, customPluginPageLayouts[0]), "utf-8")
292+
// : await fs.readFile(new URL(`./${layout}.html`, userLayoutsDir), "utf-8");
283293
} else if (customPluginDefaultPageLayouts.length > 0 || (!is404Page && hasPageLayout)) {
284294
// has a dynamic default page layout from context plugin
285295
layoutContents =

0 commit comments

Comments
 (0)