diff --git a/.github/workflows/gh-pages.yml.sample b/.github/workflows/gh-pages.yml.sample new file mode 100644 index 0000000..7aef331 --- /dev/null +++ b/.github/workflows/gh-pages.yml.sample @@ -0,0 +1,48 @@ +# If you’d like to deploy this to GitHub pages, rename this +# file to `gh-pages.yml` and read the mini-tutorial on +# https://www.11ty.dev/docs/deployment/#deploy-an-eleventy-project-to-github-pages +name: Deploy to GitHub Pages + +on: + push: + branches: + - main + pull_request: + +jobs: + deploy: + runs-on: ubuntu-22.04 + permissions: + contents: write + concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + steps: + - uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: '18' + + - name: Cache npm + uses: actions/cache@v3 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }} + + - name: Cache Eleventy .cache + uses: actions/cache@v3 + with: + path: ./.cache + key: ${{ runner.os }}-eleventy-fetch-cache + + + - run: npm install + - run: npm run build-ghpages + + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + if: github.ref == 'refs/heads/main' + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./_site diff --git a/.gitignore b/.gitignore index ab338d7..83253a1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ _site/ node_modules/ package-lock.json +.cache diff --git a/.nvmrc b/.nvmrc index b6a7d89..209e3ef 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -16 +20 diff --git a/LICENSE b/LICENSE index c97fe3d..5027c0d 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2017–2023 Zach Leatherman @zachleat +Copyright (c) 2017–2024 Zach Leatherman @zachleat Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 927d5bb..8bfc363 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ -# eleventy-base-blog v8 +# eleventy-base-blog v9 -A starter repository showing how to build a blog with the [Eleventy](https://www.11ty.dev/) site generator (using the [v2.0 release](https://www.11ty.dev/blog/eleventy-v2/)). - -[![Netlify Status](https://api.netlify.com/api/v1/badges/802669dd-d5f8-4d49-963d-6d57b257c2a2/deploy-status)](https://app.netlify.com/sites/eleventy-base-blog/deploys) +A starter repository showing how to build a blog with the [Eleventy](https://www.11ty.dev/) site generator (using the [v3.0 release](https://github.com/11ty/eleventy/releases/tag/v3.0.0)). ## Getting Started @@ -47,54 +45,56 @@ Or you can run [debug mode](https://www.11ty.dev/docs/debugging/) to see all the ## Features -- Using [Eleventy v2.0](https://www.11ty.dev/blog/eleventy-v2/) with zero-JavaScript output. +- Using [Eleventy v3](https://github.com/11ty/eleventy/releases/tag/v3.0.0) with zero-JavaScript output. - Content is exclusively pre-rendered (this is a static site). - Can easily [deploy to a subfolder without changing any content](https://www.11ty.dev/docs/plugins/html-base/) - All URLs are decoupled from the content’s location on the file system. - Configure templates via the [Eleventy Data Cascade](https://www.11ty.dev/docs/data-cascade/) - **Performance focused**: four-hundos Lighthouse score out of the box! - - [View the Lighthouse report for the latest build](https://eleventy-base-blog.netlify.app/reports/lighthouse/) courtesy of the [Netlify Lighthouse plugin](https://github.com/netlify/netlify-plugin-lighthouse). - _0 Cumulative Layout Shift_ - _0ms Total Blocking Time_ - Local development live reload provided by [Eleventy Dev Server](https://www.11ty.dev/docs/dev-server/). - Content-driven [navigation menu](https://www.11ty.dev/docs/plugins/navigation/) -- [Image optimization](https://www.11ty.dev/docs/plugins/image/) via the `{% image %}` shortcode. +- Fully automated [Image optimization](https://www.11ty.dev/docs/plugins/image/) - Zero-JavaScript output. - Support for modern image formats automatically (e.g. AVIF and WebP) + - Processes images on-request during `--serve` for speedy local builds. - Prefers `` markup if possible (single image format) but switches automatically to `` for multiple image formats. - Automated `` syntax markup with `srcset` and optional `sizes` - Includes `width`/`height` attributes to avoid [content layout shift](https://web.dev/cls/). - Includes `loading="lazy"` for native lazy loading without JavaScript. - Includes [`decoding="async"`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/decoding) - Images can be co-located with blog post files. - - View the [Image plugin source code](https://github.com/11ty/eleventy-base-blog/blob/main/eleventy.config.images.js) - Per page CSS bundles [via `eleventy-plugin-bundle`](https://github.com/11ty/eleventy-plugin-bundle). - Built-in [syntax highlighter](https://www.11ty.dev/docs/plugins/syntaxhighlight/) (zero-JavaScript output). +- Draft content: use `draft: true` to mark any template as a draft. Drafts are **only** included during `--serve`/`--watch` and are excluded from full builds. This is driven by the `addPreprocessor` configuration API in `eleventy.config.js`. Schema validator will show an error if non-boolean value is set in data cascade. - Blog Posts - - Draft posts: use `draft: true` to mark a blog post as a draft. Drafts are **only** included during `--serve`/`--watch` and are excluded from full builds. View the [Drafts plugin source code](https://github.com/11ty/eleventy-base-blog/blob/main/eleventy.config.drafts.js). - Automated next/previous links - Accessible deep links to headings - Generated Pages - Home, Archive, and About pages. - - [Feeds for Atom and JSON](https://www.11ty.dev/docs/plugins/rss/) + - [Atom feed included (with easy one-line swap to use RSS or JSON](https://www.11ty.dev/docs/plugins/rss/) - `sitemap.xml` - Zero-maintenance tag pages ([View on the Demo](https://eleventy-base-blog.netlify.app/tags/)) - Content not found (404) page ## Demos -- [Netlify](https://eleventy-base-blog.netlify.com/) -- [GitHub Pages](https://11ty.github.io/eleventy-base-blog/) +- [Netlify](https://eleventy-base-blog.netlify.app/) +- [Vercel](https://demo-base-blog.11ty.dev/) +- [Cloudflare Pages](https://eleventy-base-blog-d2a.pages.dev/) - [Remix on Glitch](https://glitch.com/~11ty-eleventy-base-blog) +- [GitHub Pages](https://11ty.github.io/eleventy-base-blog/) ## Deploy this to your own site Deploy this Eleventy site in just a few clicks on these services: -- [Get your own Eleventy web site on Netlify](https://app.netlify.com/start/deploy?repository=https://github.com/11ty/eleventy-base-blog) -- If you run Eleventy locally you can drag your `_site` folder to [`drop.netlify.com`](https://drop.netlify.com/) to upload it without using `git`. -- [Get your own Eleventy web site on Vercel](https://vercel.com/import/project?template=11ty%2Feleventy-base-blog) - Read more about [Deploying an Eleventy project](https://www.11ty.dev/docs/deployment/) to the web. +- [Deploy this to **Netlify**](https://app.netlify.com/start/deploy?repository=https://github.com/11ty/eleventy-base-blog) +- [Deploy this to **Vercel**](https://vercel.com/import/project?template=11ty%2Feleventy-base-blog) +- Look in `.github/workflows/gh-pages.yml.sample` for information on [Deploying to **GitHub Pages**](https://www.11ty.dev/docs/deployment/#deploy-an-eleventy-project-to-git-hub-pages). +- [Try it out on **Stackblitz**](https://stackblitz.com/github/11ty/eleventy-base-blog) ### Implementation Notes @@ -103,21 +103,15 @@ Deploy this Eleventy site in just a few clicks on these services: - Use the `eleventyNavigation` key (via the [Eleventy Navigation plugin](https://www.11ty.dev/docs/plugins/navigation/)) in your front matter to add a template to the top level site navigation. This is in use on `content/index.njk` and `content/about/index.md`. - Content can be in _any template format_ (blog posts needn’t exclusively be markdown, for example). Configure your project’s supported templates in `eleventy.config.js` -> `templateFormats`. - The `public` folder in your input directory will be copied to the output folder (via `addPassthroughCopy` in the `eleventy.config.js` file). This means `./public/css/*` will live at `./_site/css/*` after your build completes. -- Provides two content feeds: - - `content/feed/feed.njk` - - `content/feed/json.njk` - This project uses three [Eleventy Layouts](https://www.11ty.dev/docs/layouts/): - `_includes/layouts/base.njk`: the top level HTML structure - `_includes/layouts/home.njk`: the home page template (wrapped into `base.njk`) - `_includes/layouts/post.njk`: the blog post template (wrapped into `base.njk`) - `_includes/postslist.njk` is a Nunjucks include and is a reusable component used to display a list of all the posts. `content/index.njk` has an example of how to use it. -If your site enforces a Content Security Policy (as public-facing sites should), either, in `base.njk`, disable -```html - -``` -and enable -```html - -``` -or configure the server with the CSP directive `style-src: 'unsafe-inline'` (which is less secure). +#### Content Security Policy + +If your site enforces a [Content Security Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP) (as public-facing sites should), you have a few choices (pick one): + +1. In `base.njk`, remove `` and uncomment `` +2. Configure the server with the CSP directive `style-src: 'unsafe-inline'` (less secure). diff --git a/_config/filters.js b/_config/filters.js new file mode 100644 index 0000000..4af2fe8 --- /dev/null +++ b/_config/filters.js @@ -0,0 +1,40 @@ +import { DateTime } from "luxon"; + +export default function(eleventyConfig) { + eleventyConfig.addFilter("readableDate", (dateObj, format, zone) => { + // Formatting tokens for Luxon: https://moment.github.io/luxon/#/formatting?id=table-of-tokens + return DateTime.fromJSDate(dateObj, { zone: zone || "utc" }).toFormat(format || "dd LLLL yyyy"); + }); + + eleventyConfig.addFilter("htmlDateString", (dateObj) => { + // dateObj input: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-date-string + return DateTime.fromJSDate(dateObj, { zone: "utc" }).toFormat('yyyy-LL-dd'); + }); + + // Get the first `n` elements of a collection. + eleventyConfig.addFilter("head", (array, n) => { + if(!Array.isArray(array) || array.length === 0) { + return []; + } + if( n < 0 ) { + return array.slice(n); + } + + return array.slice(0, n); + }); + + // Return the smallest number argument + eleventyConfig.addFilter("min", (...numbers) => { + return Math.min.apply(null, numbers); + }); + + // Return the keys used in an object + eleventyConfig.addFilter("getKeys", target => { + return Object.keys(target); + }); + + eleventyConfig.addFilter("filterTagList", function filterTagList(tags) { + return (tags || []).filter(tag => ["all", "posts"].indexOf(tag) === -1); + }); + +}; diff --git a/_data/eleventyDataSchema.js b/_data/eleventyDataSchema.js new file mode 100644 index 0000000..ca764ec --- /dev/null +++ b/_data/eleventyDataSchema.js @@ -0,0 +1,13 @@ +import { z } from "zod"; +import { fromZodError } from 'zod-validation-error'; + +export default function(data) { + // Draft content, validate `draft` front matter + let result = z.object({ + draft: z.boolean().or(z.undefined()), + }).safeParse(data); + + if(result.error) { + throw fromZodError(result.error); + } +} diff --git a/_data/metadata.js b/_data/metadata.js index 5a5c99b..7e8b636 100644 --- a/_data/metadata.js +++ b/_data/metadata.js @@ -1,5 +1,5 @@ -module.exports = { - title: "Eleventy Base Blog v8", +export default { + title: "Eleventy Base Blog v9", url: "https://example.com/", language: "en", description: "I am writing about my experiences as a naval navel-gazer.", diff --git a/_includes/layouts/base.njk b/_includes/layouts/base.njk index 3b3226f..81be55d 100644 --- a/_includes/layouts/base.njk +++ b/_includes/layouts/base.njk @@ -5,33 +5,36 @@ {{ title or metadata.title }} - - {#- Atom and JSON feeds included by default #} - {#- Uncomment this if you’d like folks to know that you used Eleventy to build your site! #} {#- #} {#- - CSS bundles are provided via the `eleventy-plugin-bundle` plugin: - 1. You can add to them using `{% css %}` - 2. You can get from them using `{% getBundle "css" %}` or `{% getBundleFileUrl "css" %}` - 3. You can do the same for JS: {% js %}{% endjs %} and - 4. Learn more: https://github.com/11ty/eleventy-plugin-bundle + Plain-text bundles are provided via the `eleventy-plugin-bundle` plugin: + 1. CSS: + * Add to a per-page bundle using `{% css %}{% endcss %}` + * Retrieve bundle content using `{% getBundle "css" %}` or `{% getBundleFileUrl "css" %}` + 2. Or for JavaScript: + * Add to a per-page bundle using `{% js %}{% endjs %}` + * Retrieve via `{% getBundle "js" %}` or `{% getBundleFileUrl "js" %}` + 3. Learn more: https://github.com/11ty/eleventy-plugin-bundle #} {#- Add an arbitrary string to the bundle #} - {%- css %}* { box-sizing: border-box; }{% endcss %} + {%- css %}/* This is an arbitrary CSS string added to the bundle */{% endcss %} {#- Add the contents of a file to the bundle #} {%- css %}{% include "public/css/index.css" %}{% endcss %} - {#- Or add from node_modules #} + {#- Or you can add from node_modules #} {# {%- css %}{% include "node_modules/prismjs/themes/prism-okaidia.css" %}{% endcss %} #} - {#- Render the CSS bundle using Inlined CSS (for the fastest site performance in production) #} + {#- Render the CSS bundle using inlined CSS (for the fastest site performance in production) #} {#- Renders the CSS bundle using a separate file, if you can't set CSP directive style-src: 'unsafe-inline' #} {#- #} + + {#- Add the heading-anchors web component to the JavaScript bundle #} + {%- js %}{% include "node_modules/@zachleat/heading-anchors/heading-anchors.js" %}{% endjs %} Skip to main content @@ -51,11 +54,16 @@
- {{ content | safe }} + + {{ content | safe }} +
-
+ - + + diff --git a/_includes/layouts/home.njk b/_includes/layouts/home.njk index cfb97f6..6e75d04 100644 --- a/_includes/layouts/home.njk +++ b/_includes/layouts/home.njk @@ -1,11 +1,11 @@ --- layout: layouts/base.njk --- - + {%- css %}{% include "public/css/message-box.css" %}{% endcss %}
    -
  1. Edit the _data/metadata.js with your blog’s information.
  2. +
  3. Edit _data/metadata.js with your blog’s information.
  4. (Optional) Edit eleventy.config.js with your configuration preferences.
  5. Delete this message from _includes/layouts/home.njk.
diff --git a/_includes/layouts/post.njk b/_includes/layouts/post.njk index 9543d2d..d1827cf 100644 --- a/_includes/layouts/post.njk +++ b/_includes/layouts/post.njk @@ -1,7 +1,7 @@ --- layout: layouts/base.njk --- -{# Only include the syntax highlighter CSS on blog posts #} +{# Only include the syntax highlighter CSS on blog posts, included with the CSS per-page bundle #} {%- css %}{% include "node_modules/prismjs/themes/prism-okaidia.css" %}{% endcss %} {%- css %}{% include "public/css/prism-diff.css" %}{%- endcss %}

{{ title }}

@@ -21,8 +21,8 @@ layout: layouts/base.njk {%- set nextPost = collections.posts | getNextCollectionItem %} {%- if nextPost or previousPost %} {%- endif %} {%- endif %} diff --git a/_includes/postslist.njk b/_includes/postslist.njk index 99272c5..7ff7c6b 100644 --- a/_includes/postslist.njk +++ b/_includes/postslist.njk @@ -1,9 +1,9 @@ {%- css %}.postlist { counter-reset: start-from {{ (postslistCounter or postslist.length) + 1 }} }{% endcss %}
    -{% for post in postslist | reverse %} +{%- for post in postslist | reverse %}
  1. {% if post.data.title %}{{ post.data.title }}{% else %}{{ post.url }}{% endif %}
  2. -{% endfor %} +{%- endfor %}
diff --git a/content/404.md b/content/404.md index bd51f61..50a3fa9 100644 --- a/content/404.md +++ b/content/404.md @@ -1,19 +1,20 @@ --- -layout: layouts/home.njk permalink: 404.html eleventyExcludeFromCollections: true --- # Content not found. -Go home. +Go home. diff --git a/content/about.md b/content/about.md new file mode 100644 index 0000000..fba58a9 --- /dev/null +++ b/content/about.md @@ -0,0 +1,9 @@ +---js +const eleventyNavigation = { + key: "About", + order: 3 +}; +--- +# About + +I am a person that writes stuff. diff --git a/content/about/index.md b/content/about/index.md deleted file mode 100644 index 18367d8..0000000 --- a/content/about/index.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -layout: layouts/base.njk -eleventyNavigation: - key: About Me - order: 3 ---- -# About Me - -I am a person that writes stuff. diff --git a/content/blog.njk b/content/blog.njk index c7e04d6..c11fdf8 100644 --- a/content/blog.njk +++ b/content/blog.njk @@ -1,8 +1,8 @@ ---- -layout: layouts/home.njk -eleventyNavigation: - key: Archive - order: 2 +---js +const eleventyNavigation = { + key: "Archive", + order: 2 +}; ---

Archive

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/content/blog/fifthpost.md b/content/blog/fifthpost.md index b173821..6ff059b 100644 --- a/content/blog/fifthpost.md +++ b/content/blog/fifthpost.md @@ -1,6 +1,6 @@ ---- -title: This is a fifth post (draft) -date: 2023-01-23 -draft: true +---js +const title = "This is a fifth post (draft)"; +const date = "2023-01-23"; +const draft = true; --- This is a draft post diff --git a/content/blog/firstpost.md b/content/blog/firstpost.md index 0557716..97db357 100644 --- a/content/blog/firstpost.md +++ b/content/blog/firstpost.md @@ -2,8 +2,7 @@ title: This is my first post. description: This is a post on My Blog about agile frameworks. date: 2018-05-01 -tags: - - another tag +tags: another tag --- Leverage agile frameworks to provide a robust synopsis for high level overviews. Iterative approaches to corporate strategy foster collaborative thinking to further the overall value proposition. Organically grow the holistic world view of disruptive innovation via workplace diversity and empowerment. diff --git a/content/blog/fourthpost/fourthpost.md b/content/blog/fourthpost/fourthpost.md index 8149f7c..776583a 100644 --- a/content/blog/fourthpost/fourthpost.md +++ b/content/blog/fourthpost/fourthpost.md @@ -1,5 +1,5 @@ --- -title: This is my fourth post. +title: This is my fourth post description: This is a post on My Blog about touchpoints and circling wagons. date: 2018-09-30 tags: second tag @@ -8,7 +8,7 @@ Leverage agile frameworks to provide a robust synopsis for high level overviews. Bring to the table win-win survival strategies to ensure proactive domination. At the end of the day, going forward, a new normal that has evolved from generation X is on the runway heading towards a streamlined cloud solution. User generated content in real-time will have multiple touchpoints for offshoring. -{% image "./possum.png", "A possum parent and two possum kids hanging from the iconic red balloon" %} +A possum parent and two possum kids hanging from the iconic red balloon ## Section Header diff --git a/content/blog/secondpost.md b/content/blog/secondpost.md index 3c521a6..b308bff 100644 --- a/content/blog/secondpost.md +++ b/content/blog/secondpost.md @@ -2,15 +2,14 @@ title: This is my second post with a much longer title. description: This is a post on My Blog about leveraging agile frameworks. date: 2018-07-04 -tags: - - number 2 +tags: number 2 --- Leverage agile frameworks to provide a robust synopsis for high level overviews. Iterative approaches to corporate strategy foster collaborative thinking to further the overall value proposition. Organically grow the holistic world view of disruptive innovation via workplace diversity and empowerment. ## Section Header -First post -Third post +First post +Third post Bring to the table win-win survival strategies to ensure proactive domination. At the end of the day, going forward, a new normal that has evolved from generation X is on the runway heading towards a streamlined cloud solution. User generated content in real-time will have multiple touchpoints for offshoring. diff --git a/content/blog/thirdpost.md b/content/blog/thirdpost.md index bdea878..7a95dd6 100644 --- a/content/blog/thirdpost.md +++ b/content/blog/thirdpost.md @@ -2,15 +2,13 @@ title: This is my third post. description: This is a post on My Blog about win-win survival strategies. date: 2018-08-24 -tags: - - second tag - - posts with two tags +tags: ["second tag", "posts with two tags"] --- Leverage agile frameworks to provide a robust synopsis for high level overviews. Iterative approaches to corporate strategy foster collaborative thinking to further the overall value proposition. Organically grow the holistic world view of disruptive innovation via workplace diversity and empowerment. ## Code -### Styled (with Syntax) +### This is a very long heading that I want to wrap This is a very long heading that I want to wrap This is a very long heading that I want to wrap This is a very long heading that I want to wrap Bring to the table win-win survival strategies to ensure proactive domination. At the end of the day, going forward, a new normal that has evolved from generation X is on the runway heading towards a streamlined cloud solution. User generated content in real-time will have multiple touchpoints for offshoring. @@ -25,7 +23,7 @@ function myCommand() { console.log('Test'); ``` -### Unstyled +### Heading with a [link](#code) Bring to the table win-win survival strategies to ensure proactive domination. At the end of the day, going forward, a new normal that has evolved from generation X is on the runway heading towards a streamlined cloud solution. User generated content in real-time will have multiple touchpoints for offshoring. diff --git a/content/content.11tydata.js b/content/content.11tydata.js new file mode 100644 index 0000000..8b0bb8e --- /dev/null +++ b/content/content.11tydata.js @@ -0,0 +1,3 @@ +export default { + layout: "layouts/home.njk", +}; diff --git a/content/feed/.virtual b/content/feed/.virtual new file mode 100644 index 0000000..0ee5e54 --- /dev/null +++ b/content/feed/.virtual @@ -0,0 +1 @@ +For RSS feed, Atom Feed, and JSON feed templates, see the plugin in eleventy.config.js diff --git a/content/feed/feed.11tydata.js b/content/feed/feed.11tydata.js deleted file mode 100644 index ed3fec9..0000000 --- a/content/feed/feed.11tydata.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - eleventyExcludeFromCollections: true -} diff --git a/content/feed/feed.njk b/content/feed/feed.njk deleted file mode 100755 index a47a7e8..0000000 --- a/content/feed/feed.njk +++ /dev/null @@ -1,27 +0,0 @@ ---- -# Metadata comes from _data/metadata.js -permalink: /feed/feed.xml ---- - - - {{ metadata.title }} - {{ metadata.description }} - - - {{ collections.posts | getNewestCollectionItemDate | dateToRfc3339 }} - {{ metadata.url }} - - {{ metadata.author.name }} - {{ metadata.author.email }} - - {%- for post in collections.posts | reverse %} - {% set absolutePostUrl %}{{ post.url | htmlBaseUrl(metadata.url) }}{% endset %} - - {{ post.data.title }} - - {{ post.date | dateToRfc3339 }} - {{ absolutePostUrl }} - {{ post.templateContent | transformWithHtmlBase(absolutePostUrl, post.url) }} - - {%- endfor %} - diff --git a/content/feed/json.njk b/content/feed/json.njk deleted file mode 100644 index 3b33b59..0000000 --- a/content/feed/json.njk +++ /dev/null @@ -1,29 +0,0 @@ ---- -# Metadata comes from _data/metadata.js -permalink: /feed/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/feed/pretty-atom-feed.xsl b/content/feed/pretty-atom-feed.xsl new file mode 100644 index 0000000..6a1c4de --- /dev/null +++ b/content/feed/pretty-atom-feed.xsl @@ -0,0 +1,89 @@ + + + + + + + + <xsl:value-of select="atom:feed/atom:title"/> + + + + + + +
+
+

+ + + + + + + + + + + + + + + + + + + Web Feed Preview +

+

+

+

This preview only shows titles, but the actual feed contains the full content.

+ + + + + Visit Website → + +
+

Recent Items

+ +
+ + +
+ +
+

+ + + + + + +

+ + Published: + +
+
+
diff --git a/content/index.njk b/content/index.njk index c23cd54..f7d17e1 100644 --- a/content/index.njk +++ b/content/index.njk @@ -1,9 +1,10 @@ ---- -layout: layouts/home.njk -eleventyNavigation: - key: Home - order: 1 -numberOfLatestPostsToShow: 3 +---js +const eleventyNavigation = { + key: "Home", + order: 1 +}; + +const numberOfLatestPostsToShow = 3; --- {% set postsCount = collections.posts | length %} {% set latestPostsCount = postsCount | min(numberOfLatestPostsToShow) %} @@ -15,7 +16,7 @@ numberOfLatestPostsToShow: 3 {% set morePosts = postsCount - numberOfLatestPostsToShow %} {% if morePosts > 0 %} -

{{ morePosts }} more post{% if morePosts != 1 %}s{% endif %} can be found in the archive.

+

{{ morePosts }} more post{% if morePosts != 1 %}s{% endif %} can be found in the archive.

{% endif %} {# List every content page in the project #} diff --git a/content/sitemap/sitemap.xml.njk b/content/sitemap.xml.njk similarity index 96% rename from content/sitemap/sitemap.xml.njk rename to content/sitemap.xml.njk index 4da684a..ec1716d 100644 --- a/content/sitemap/sitemap.xml.njk +++ b/content/sitemap.xml.njk @@ -1,5 +1,6 @@ --- permalink: /sitemap.xml +layout: false eleventyExcludeFromCollections: true --- diff --git a/content/tag-pages.njk b/content/tag-pages.njk new file mode 100644 index 0000000..a69aeef --- /dev/null +++ b/content/tag-pages.njk @@ -0,0 +1,25 @@ +---js +//