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.
Files changed (2) hide show
  1. package/index.js +12 -6
  2. 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
- if (normalized.endsWith("index.html")) {
151
- const trimmed = normalized.slice(0, -"index.html".length);
152
- return trimmed ? `/${trimmed}` : "/";
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
- return `/${normalized}`;
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
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "basecampjs",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "type": "module",
5
5
  "description": "BasecampJS engine for CampsiteJS static site generator.",
6
6
  "bin": {