Skip to content

Commit dde9e16

Browse files
authored
Merge pull request #1 from si/codex/migrate-wordpress-blog-to-11ty-structure
2 parents 02fea2c + c302f83 commit dde9e16

14 files changed

Lines changed: 30 additions & 168 deletions

.eleventy.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ module.exports = function (eleventyConfig) {
174174
return collectionApi.getFilteredByTag("posts");
175175
});
176176
eleventyConfig.addCollection("tagList", require("./_11ty/getTagList"));
177+
// Copy migrated assets from src/assets to /assets in the built site.
178+
eleventyConfig.addPassthroughCopy({ "src/assets": "assets" });
177179
eleventyConfig.addPassthroughCopy("img");
178180
eleventyConfig.addPassthroughCopy("css");
179181
// We need to copy cached.js only if GA is used

.eleventyignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,4 @@ README.md
1010
third_party
1111
functions
1212
test
13-
src
1413
.oryx_prod_node_modules/

posts/daylight-saving-timezones-in-php.md

Lines changed: 0 additions & 33 deletions
This file was deleted.

posts/fifthpost.md

Lines changed: 0 additions & 10 deletions
This file was deleted.

posts/firstpost.md

Lines changed: 0 additions & 31 deletions
This file was deleted.

posts/fourthpost.md

Lines changed: 0 additions & 22 deletions
This file was deleted.

posts/posts.11tydata.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,22 @@ module.exports = () => {
1414
eleventyComputed: {
1515
eleventyExcludeFromCollections: (data) =>
1616
showDraft(data) ? data.eleventyExcludeFromCollections : true,
17-
permalink: (data) => (showDraft(data) ? data.permalink : false),
17+
permalink: (data) => {
18+
if (!showDraft(data)) return false;
19+
20+
if (data.permalink) return data.permalink;
21+
22+
const categories = Array.isArray(data.categories) ? data.categories : [];
23+
const primaryCategory = data.primaryCategory || categories[0];
24+
const slug = data.page && data.page.fileSlug ? data.page.fileSlug : "";
25+
26+
if (primaryCategory) {
27+
return `/${primaryCategory}/${slug}/`;
28+
}
29+
30+
// Default to a flat permalink so posts do not inherit the /posts/ prefix.
31+
return `/${slug}/`;
32+
},
1833
},
1934
tags: ["posts"],
2035
};

posts/secondpost.md

Lines changed: 0 additions & 32 deletions
This file was deleted.

posts/sixthpostdraft.md

Lines changed: 0 additions & 9 deletions
This file was deleted.

posts/thirdpost.md

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)