Profile picture Schedule a Meeting
c a n d l a n d . n e t

11ty 404 page template

Dusty Candland | | eleventy

Example 404 page for an 11ty site.

Add a dataDisplay filter to .eleventy.js

module.exports = function (eleventyConfig) {
  eleventyConfig.addNunjucksFilter('dateDisplay', function (date) {
    return date.toISOString()
  })

  ...

}

Create a /404.njk file


---
permalink: /sitemap.xml
sitemapIgnore: true
---
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{%- for item in collections.all %}
{%- if item.data.sitemapIgnore !== true %}
  <url>
    <loc>{{ site.url }}{{ item.url }}</loc>
    {% if item.data.premier.date -%}
    <lastmod>{{ item.data.premier.date | dateDisplay("toISOString") }}</lastmod>
    {%- else -%}
    <lastmod>{{ item.date | dateDisplay("toISOString") }}</lastmod>
    {%- endif %}
    <changefreq>{{ item.data.changefreq | default("monthly", true) }}</changefreq>
    <priority>{{ item.data.priority | default("0.5", true) }}</priority>
  </url>
{%- endif %}
{%- endfor %}
</urlset>

Overrides in Frontmatter

  • changefreq
  • priority
  • sitemapIgnore

Webmentions

These are webmentions via the IndieWeb and webmention.io. Mention this post from your site: