diff --git a/.eleventy.js b/.eleventy.js index 3b2c307..4b96123 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -105,8 +105,8 @@ module.exports = function (eleventyConfig) { collection.getFilteredByGlob("./src/_pages/**/*") ); - eleventyConfig.addCollection("posts", (collection) => - collection + eleventyConfig.addCollection("posts", (collection) => { + availablePages = collection .getFilteredByGlob("./src/_posts/**/*") .filter( (item) => item.data.draft !== true && item.date <= new Date() @@ -118,8 +118,10 @@ module.exports = function (eleventyConfig) { prev: all[i + 1], }; return cur; - }) - ); + }); + + return availablePages; + }); eleventyConfig.addCollection("projects", (collection) => collection @@ -259,7 +261,11 @@ module.exports = function (eleventyConfig) { eleventyConfig.addPassthroughCopy("src/assets"); // eleventyConfig.addPassthroughCopy({ "src/_sass": "assets/css" }); - eleventyConfig.addShortcode("post_url", (collection, slug) => { + let availablePages = []; + + eleventyConfig.addShortcode("post_url", (slug) => { + let collection = availablePages; + try { if (collection.length < 1) { throw "Collection appears to be empty"; @@ -279,7 +285,7 @@ module.exports = function (eleventyConfig) { } } catch (e) { console.error( - `RMCG:An error occured while searching for the url to ${slug}. Details:`, + `RMCG:An error occurred while searching for the url to ${slug}. Details:`, e ); } diff --git a/src/_posts/2020-04-21-learning-web-development.md b/src/_posts/2020-04-21-learning-web-development.md index 0b9d788..4721b74 100644 --- a/src/_posts/2020-04-21-learning-web-development.md +++ b/src/_posts/2020-04-21-learning-web-development.md @@ -23,7 +23,7 @@ gallery: title: DevOps Roadmap date: 2020-04-21 00:44:00 +01:00 --- -I mentioned in the [goals post]({% post_url collections.posts, "goals" %}), one of the things I am aiming to do is to start learning web development. +I mentioned in the [goals post]({% post_url "goals" %}), one of the things I am aiming to do is to start learning web development. I was well aware that what falls under the banner of web development is massive, I just hadn't realised quite how large it was. diff --git a/src/index.html b/src/index.html index 2be47ae..9ea7727 100644 --- a/src/index.html +++ b/src/index.html @@ -7,9 +7,9 @@ pagination: --- {%- for post in pagination.items -%} -

{{ post.data.title }}

+

{{ post.data.title }}

{{ post.data.date | toUTCString}} -

{{ post.templateContent | description }} read more

+

{{ post.templateContent | description }} read more

{%- endfor -%} @@ -45,4 +45,4 @@ pagination: {% endif %} - + \ No newline at end of file