diff --git a/_data/metadata.js b/_data/metadata.js index 103362a..4c48f41 100644 --- a/_data/metadata.js +++ b/_data/metadata.js @@ -1,11 +1,9 @@ -module.exports = { - title: "nycki.net", - url: "https://nycki.net", - language: "en", - description: "nycki.net", - author: { - name: "Your Name Here", - email: "youremailaddress@example.com", - url: "https://example.com/about-me/" - } -} +export const title = "nycki.net"; +export const url = "https://nycki.net"; +export const language = "en"; +export const description = "nycki.net"; +export const author = { + name: "Your Name Here", + email: "youremailaddress@example.com", + url: "https://example.com/about-me/" +}; diff --git a/content/blog-feed/feed.11tydata.js b/content/blog-feed/feed.11tydata.js index ed3fec9..b2f94c1 100644 --- a/content/blog-feed/feed.11tydata.js +++ b/content/blog-feed/feed.11tydata.js @@ -1,3 +1 @@ -module.exports = { - eleventyExcludeFromCollections: true -} +export const eleventyExcludeFromCollections = true; diff --git a/content/blog-feed/feed.njk b/content/blog-feed/feed.njk index f4bdfbb..3b2099b 100644 --- a/content/blog-feed/feed.njk +++ b/content/blog-feed/feed.njk @@ -7,7 +7,7 @@ permalink: /blog/feed.xml {{ metadata.title }} {{ metadata.description }} - + {{ collections.posts | getNewestCollectionItemDate | dateToRfc3339 }} {{ metadata.url }} diff --git a/content/blog-feed/json.njk b/content/blog-feed/json.njk deleted file mode 100644 index 9cab7cd..0000000 --- a/content/blog-feed/json.njk +++ /dev/null @@ -1,29 +0,0 @@ ---- -# Metadata comes from _data/metadata.js -permalink: /blog/feed.json ---- -{ - "version": "https://jsonfeed.org/version/1.1", - "title": "{{ metadata.title }}", - "language": "{{ metadata.language }}", - "home_page_url": "{{ metadata.url | addPathPrefixToFullUrl }}", - "feed_url": "{{ permalink | htmlBaseUrl(metadata.url) }}", - "description": "{{ metadata.description }}", - "author": { - "name": "{{ metadata.author.name }}", - "url": "{{ metadata.author.url }}" - }, - "items": [ - {%- for post in collections.posts | reverse %} - {%- set absolutePostUrl = post.url | htmlBaseUrl(metadata.url) %} - { - "id": "{{ absolutePostUrl }}", - "url": "{{ absolutePostUrl }}", - "title": "{{ post.data.title }}", - "content_html": {% if post.templateContent %}{{ post.templateContent | transformWithHtmlBase(absolutePostUrl, post.url) | dump | safe }}{% else %}""{% endif %}, - "date_published": "{{ post.date | dateToRfc3339 }}" - } - {% if not loop.last %},{% endif %} - {%- endfor %} - ] -} diff --git a/content/blog/blog.11tydata.js b/content/blog/blog.11tydata.js index 2d655b1..614f505 100644 --- a/content/blog/blog.11tydata.js +++ b/content/blog/blog.11tydata.js @@ -1,4 +1,4 @@ -module.exports = { +export default { tags: [ "posts" ], diff --git a/eleventy.config.drafts.js b/eleventy.config.drafts.js index 8eb92dc..ecc2540 100644 --- a/eleventy.config.drafts.js +++ b/eleventy.config.drafts.js @@ -24,10 +24,12 @@ function eleventyComputedExcludeFromCollections() { } }; -module.exports.eleventyComputedPermalink = eleventyComputedPermalink; -module.exports.eleventyComputedExcludeFromCollections = eleventyComputedExcludeFromCollections; +const _eleventyComputedPermalink = eleventyComputedPermalink; +export { _eleventyComputedPermalink as eleventyComputedPermalink }; +const _eleventyComputedExcludeFromCollections = eleventyComputedExcludeFromCollections; +export { _eleventyComputedExcludeFromCollections as eleventyComputedExcludeFromCollections }; -module.exports = eleventyConfig => { +export default eleventyConfig => { eleventyConfig.addGlobalData("eleventyComputed.permalink", eleventyComputedPermalink); eleventyConfig.addGlobalData("eleventyComputed.eleventyExcludeFromCollections", eleventyComputedExcludeFromCollections); diff --git a/eleventy.config.js b/eleventy.config.js index 6ba9001..d7eba9a 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -1,16 +1,13 @@ -const { DateTime } = require("luxon"); -const markdownItAnchor = require("markdown-it-anchor"); +import { DateTime } from "luxon"; +import pluginSyntaxHighlight from "@11ty/eleventy-plugin-syntaxhighlight"; +import { EleventyHtmlBasePlugin } from "@11ty/eleventy"; +import pluginRss from '@11ty/eleventy-plugin-rss'; +import pluginUpgrade from '@11ty/eleventy-upgrade-help'; -const pluginRss = require("@11ty/eleventy-plugin-rss"); -const pluginSyntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight"); -const pluginBundle = require("@11ty/eleventy-plugin-bundle"); -const pluginNavigation = require("@11ty/eleventy-navigation"); -const { EleventyHtmlBasePlugin } = require("@11ty/eleventy"); - -const pluginDrafts = require("./eleventy.config.drafts.js"); +import pluginDrafts from "./eleventy.config.drafts.js"; /** @param {import('@11ty/eleventy').UserConfig} eleventyConfig */ -module.exports = function(eleventyConfig) { +export default function(eleventyConfig) { if (process.env.NODE_ENV === 'localhost') { console.log('metadata override'); eleventyConfig.addGlobalData('metadata.url', 'http://localhost:8080'); @@ -30,16 +27,15 @@ module.exports = function(eleventyConfig) { // App plugins eleventyConfig.addPlugin(pluginDrafts); - // eleventyConfig.addPlugin(pluginImages); // Official plugins - eleventyConfig.addPlugin(pluginRss); + eleventyConfig.addBundle('css'); eleventyConfig.addPlugin(pluginSyntaxHighlight, { preAttributes: { tabindex: 0 } }); - eleventyConfig.addPlugin(pluginNavigation); eleventyConfig.addPlugin(EleventyHtmlBasePlugin); - eleventyConfig.addPlugin(pluginBundle); + eleventyConfig.addPlugin(pluginRss); + eleventyConfig.addPlugin(pluginUpgrade); // Filters eleventyConfig.addFilter("readableDate", (dateObj, format, zone) => { @@ -96,20 +92,6 @@ module.exports = function(eleventyConfig) { } }); - // Customize Markdown library settings: - eleventyConfig.amendLibrary("md", mdLib => { - mdLib.use(markdownItAnchor, { - permalink: markdownItAnchor.permalink.ariaHidden({ - placement: "after", - class: "header-anchor", - symbol: "#", - ariaHidden: false, - }), - level: [1,2,3,4], - slugify: eleventyConfig.getFilter("slugify") - }); - }); - eleventyConfig.addShortcode("currentBuildDate", () => { return (new Date()).toISOString(); }) diff --git a/package.json b/package.json index eb76e6c..85a7e79 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "eleventy-base-blog", "version": "8.0.0", "description": "A starter repository for a blog web site using the Eleventy site generator.", + "type": "module", "scripts": { "build": "npx @11ty/eleventy", "build-ghpages": "npx @11ty/eleventy --pathprefix=/eleventy-base-blog/", @@ -33,12 +34,10 @@ }, "homepage": "https://github.com/11ty/eleventy-base-blog#readme", "devDependencies": { - "@11ty/eleventy": "^2.0.1", - "@11ty/eleventy-img": "^3.1.1", - "@11ty/eleventy-navigation": "^0.3.5", - "@11ty/eleventy-plugin-bundle": "^1.0.4", + "@11ty/eleventy": "^3.0.0", "@11ty/eleventy-plugin-rss": "^1.2.0", "@11ty/eleventy-plugin-syntaxhighlight": "^5.0.0", + "@11ty/eleventy-upgrade-help": "^3.0.1", "cross-env": "^7.0.3", "luxon": "^3.3.0", "markdown-it-anchor": "^8.6.7"