basecampjs 0.0.4 → 0.0.5
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/index.js +12 -6
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -147,18 +147,24 @@ function createLiquidEnv(layoutsDir, pagesDir, srcDir) {
|
|
|
147
147
|
|
|
148
148
|
function toUrlPath(outRel) {
|
|
149
149
|
const normalized = outRel.replace(/\\/g, "/");
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
150
|
+
let path = `/${normalized}`;
|
|
151
|
+
// Remove trailing index.html for directory-style URLs
|
|
152
|
+
if (path.endsWith("index.html")) {
|
|
153
|
+
path = path.slice(0, -"index.html".length);
|
|
153
154
|
}
|
|
154
|
-
|
|
155
|
+
// Strip trailing slash except for root
|
|
156
|
+
if (path !== "/" && path.endsWith("/")) {
|
|
157
|
+
path = path.slice(0, -1);
|
|
158
|
+
}
|
|
159
|
+
return path || "/";
|
|
155
160
|
}
|
|
156
161
|
|
|
157
162
|
function pageContext(frontmatter, html, config, relPath, data, path = "/") {
|
|
158
163
|
return {
|
|
159
164
|
site: { name: config.siteName, config },
|
|
160
165
|
page: { ...frontmatter, content: html, source: relPath, path },
|
|
161
|
-
collections: data
|
|
166
|
+
collections: data,
|
|
167
|
+
...data
|
|
162
168
|
};
|
|
163
169
|
}
|
|
164
170
|
|
|
@@ -412,4 +418,4 @@ async function main() {
|
|
|
412
418
|
main().catch((err) => {
|
|
413
419
|
console.error(err);
|
|
414
420
|
exit(1);
|
|
415
|
-
});
|
|
421
|
+
});
|