@rmdes/indiekit-preset-eleventy 1.0.0-beta.25 → 1.0.0-beta.27
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/lib/post-template.js +11 -1
- package/lib/post-types.js +1 -1
- package/package.json +1 -1
package/lib/post-template.js
CHANGED
|
@@ -58,8 +58,18 @@ const getFrontMatter = (properties) => {
|
|
|
58
58
|
|
|
59
59
|
// Convert url to Eleventy permalink so generated URL matches Indiekit's stored URL
|
|
60
60
|
// Add trailing slash to generate /path/index.html instead of /path.html
|
|
61
|
+
// Extract path from full URL since Eleventy expects a path, not a full URL
|
|
61
62
|
if (properties.url) {
|
|
62
|
-
|
|
63
|
+
let url = properties.url;
|
|
64
|
+
// If it's a full URL, extract just the pathname
|
|
65
|
+
if (url.startsWith("http://") || url.startsWith("https://")) {
|
|
66
|
+
try {
|
|
67
|
+
const parsed = new URL(url);
|
|
68
|
+
url = parsed.pathname;
|
|
69
|
+
} catch {
|
|
70
|
+
// If URL parsing fails, use as-is
|
|
71
|
+
}
|
|
72
|
+
}
|
|
63
73
|
properties.permalink = url.endsWith("/") ? url : `${url}/`;
|
|
64
74
|
}
|
|
65
75
|
delete properties.url;
|
package/lib/post-types.js
CHANGED
|
@@ -13,7 +13,7 @@ export const getPostTypes = (postTypes) => {
|
|
|
13
13
|
...postTypes.get(type),
|
|
14
14
|
post: {
|
|
15
15
|
path: `${collection}/{yyyy}-{MM}-{dd}-{slug}.md`,
|
|
16
|
-
url:
|
|
16
|
+
url: `content/${collection}/{yyyy}-{MM}-{dd}-{slug}`,
|
|
17
17
|
},
|
|
18
18
|
media: {
|
|
19
19
|
path: `media/${collection}/{yyyy}/{MM}/{dd}/{filename}`,
|