diff --git a/_includes/event.njk b/_includes/event.njk new file mode 100644 index 0000000..c410005 --- /dev/null +++ b/_includes/event.njk @@ -0,0 +1,8 @@ +

{{ event.data.title }}

+

+ +

+

{{ event.content | safe }}

+{% if event.data.ics %} +

Add {{ event.data.title }} to your calendar

+{% endif %} diff --git a/eleventy.config.js b/eleventy.config.js index 7b71e6f..a38af49 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -2,6 +2,8 @@ import { HtmlBasePlugin } from "@11ty/eleventy"; import { eleventyImageTransformPlugin } from "@11ty/eleventy-img"; import eleventyNavigationPlugin from "@11ty/eleventy-navigation"; +import { consolePlus } from 'eleventy-plugin-console-plus'; + import { attrs } from "@mdit/plugin-attrs"; import { markdownitLinkAttributes } from 'markdown-it-link-attributes'; import markdownitIdAttributes from "markdown-it-anchor"; @@ -47,9 +49,13 @@ export default async function (eleventyConfig) { /* Passthroughs */ eleventyConfig .addPassthroughCopy("favicon.ico") - .addPassthroughCopy("robots.txt"); + .addPassthroughCopy("robots.txt") + .addPassthroughCopy("ics"); /* Plugins */ + /* Debug */ + eleventyConfig.addPlugin(consolePlus); + /* HTML base */ eleventyConfig.addPlugin(HtmlBasePlugin); @@ -81,7 +87,8 @@ export default async function (eleventyConfig) { /* Permalink: true handling */ eleventyConfig.addPreprocessor("permalinkTrue", "md", (data, content) => { - if (data.permalink === true) delete data.permalink; + if (data.permalink === true) + data.permalink = `/${eleventyConfig.getFilter("slugify")(data.title)}/index.html`; return content; }) @@ -92,6 +99,7 @@ export default async function (eleventyConfig) { /* Watch when serving */ eleventyConfig.addWatchTarget("css"); + eleventyConfig.addWatchTarget("js"); } export const config = { diff --git a/src/calendar.njk b/src/calendar.njk index 8a73fda..09efad6 100644 --- a/src/calendar.njk +++ b/src/calendar.njk @@ -6,7 +6,7 @@ title: Calendar of Events {% for event in collections.events | sortByDate %} {% if not event.data.date | inThePast %} -

{{ event.data.title }}

+ {% include "event.njk" %} {% endif %} {% endfor %} @@ -14,6 +14,6 @@ title: Calendar of Events {% for event in collections.events | sortByDate | reverse %} {% if event.data.date | inThePast %} -

{{ event.data.title }}

+ {% include "event.njk" %} {% endif %} {% endfor %}