@lumeland/core 1.0.0-beta-9 → 1.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/src/renderer.js +4 -4
- package/package.json +1 -1
package/build/src/renderer.js
CHANGED
|
@@ -161,7 +161,7 @@ export default class Renderer {
|
|
|
161
161
|
/** Render the page layout */
|
|
162
162
|
async #renderLayout(page, content) {
|
|
163
163
|
let data = { ...page.data };
|
|
164
|
-
let
|
|
164
|
+
let fromDir = posix.dirname(page.src.path + page.src.ext);
|
|
165
165
|
let layout = data.layout;
|
|
166
166
|
// Render the layouts recursively
|
|
167
167
|
while (layout) {
|
|
@@ -169,9 +169,9 @@ export default class Renderer {
|
|
|
169
169
|
if (!format || !format.loader) {
|
|
170
170
|
throw new Error(`The layout format "${layout}" doesn't exist`);
|
|
171
171
|
}
|
|
172
|
-
const layoutEntry = getInclude(
|
|
172
|
+
const layoutEntry = getInclude(fromDir, layout, this.fs);
|
|
173
173
|
if (!layoutEntry) {
|
|
174
|
-
throw new Error(`The layout file "${layout}"
|
|
174
|
+
throw new Error(`The layout file "${layout}" from the dir "${fromDir}" doesn't exist`);
|
|
175
175
|
}
|
|
176
176
|
const layoutData = await layoutEntry.getContent(format.loader);
|
|
177
177
|
delete data.layout;
|
|
@@ -179,7 +179,7 @@ export default class Renderer {
|
|
|
179
179
|
data = mergeData(layoutData, data, { content });
|
|
180
180
|
content = await this.render(layoutData.content, data, layoutEntry.path, true);
|
|
181
181
|
layout = layoutData.layout;
|
|
182
|
-
|
|
182
|
+
fromDir = posix.dirname(layoutEntry.path);
|
|
183
183
|
}
|
|
184
184
|
return content;
|
|
185
185
|
}
|