},
htmlTemplateEngine: "njk",
markdownTemplateEngine: "njk"
+ },
+
+ // ---- Collections ----
+ eleventyConfig.addCollection("blog", (api) =>
+ api.getFilteredByGlob("site/blog/*.md")
+ );
+
+ // ---- Date filter (works in Nunjucks & Liquid) ----
+ function dateFmt(value, fmt = "yyyy-MM-dd") {
+ if (!value) return "";
+ const d = value instanceof Date ? value : new Date(value);
+ const pad = (n) => String(n).padStart(2, "0");
+ const yyyy = d.getFullYear();
+ const MM = pad(d.getMonth() + 1);
+ const dd = pad(d.getDate());
+ const HH = pad(d.getHours());
+ const mm = pad(d.getMinutes());
+ const map = { yyyy, MM, dd, HH, mm };
+ return fmt.replace(/yyyy|MM|dd|HH|mm/g, (t) => map[t]);
}
-}
+
+ // Register for all template engines to be safe
+ eleventyConfig.addFilter("date", dateFmt); // universal
+ eleventyConfig.addNunjucksFilter("date", dateFmt); // Nunjucks
+ eleventyConfig.addLiquidFilter("date", dateFmt); // Liquid
+
+ // Copy the whole assets tree (css/js/img/fonts…) to /assets
+ eleventyConfig.addPassthroughCopy({ "site/assets": "assets" });
+
+ // Engines + dirs
+ return {
+ dir: { input: "site", output: "dist", includes: "_includes" },
+ markdownTemplateEngine: "njk",
+ htmlTemplateEngine: "njk"
+ };
+};
<!-- LOAD YOUR CSS -->
<link rel="stylesheet" href="/assets/styles.css">
+ <!-- Favicons -->
<link rel="icon" href="/zndr.svg" type="image/svg+xml">
<link rel="icon" type="image/png" href="/favicon-32.png" sizes="32x32">
<link rel="icon" type="image/png" href="/favicon-16.png" sizes="16x16">
<link rel="icon" href="/favicon.ico" sizes="any">
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
-
- <!-- Favicons
- <link rel="icon" href="/zndr.svg" type="image/svg+xml">
- <link rel="icon" href="/favicon.png" sizes="32x32">
- <link rel="icon" href="/favicon.ico" sizes="any">
- <link rel="apple-touch-icon" href="/apple-touch-icon.png">
- -->
<link rel="manifest" href="/site.webmanifest">
<meta name="theme-color" content="#10a37f">
</head>
<div class="foot-links">
<a href="/pgp.txt">PGP</a>
<a href="/keys.txt">SSH Keys</a>
- <a href="/about.html">About</a>
+ <a href="/about/">About</a>
</div>
</footer>
</div>
--- /dev/null
+{% extends "layouts/base.njk" %}
+
+{% block content %}
+ <article class="post">
+ <h1>{{ title }}</h1>
+ {% if date %}
+ <p class="post-meta">Published {{ date | date("yyyy-MM-dd") }}</p>
+ {% endif %}
+
+ <div class="post-body">
+ {{ content | safe }}
+ </div>
+ </article>
+{% endblock %}
+
.card:hover { transform: none; box-shadow: none; }
}
+/* Blog content images */
+.post-body img {
+ max-width: 100%; /* never overflow the text column */
+ height: auto; /* keep aspect ratio */
+ display: block; /* remove inline gap */
+ margin: 12px auto; /* space + center */
+ border-radius: 8px; /* optional: soften corners */
+ box-shadow: 0 2px 8px rgba(0,0,0,.15); /* optional: subtle depth */
+}
--- /dev/null
+---
+layout: layouts/blog.njk
+tag: house
+author: JZ
+title: Small forrest in front of house
+location: Tange
+date: "2019-01-02"
+---
+
+
+I have been spending weeks cutting down the small forrest in front of our house. So now we have something that resembles a garden.
+
+
+
+
+Before it looked like this
+
+
--- /dev/null
+---
+layout: layouts/blog.njk
+tags:
+ - kayak
+ - house
+title: Floating dock
+author: JZ
+location: Tange
+date: "2019-08-08"
+---
+
+
+Here is a nice floating dock I built for children to play, and for me and my kayak.
+
+
+
--- /dev/null
+---
+layout: layouts/base.njk
+title: Blog — zndr.dk
+permalink: /blog/
+---
+
+<h1>Blog</h1>
+<ul>
+ {% for post in collections.blog | reverse %}
+ <li>
+ <a href="{{ post.url }}">{{ post.data.title }}</a>
+ </li>
+ {% endfor %}
+</ul>
+
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url><loc>https://zndr.dk/</loc></url>
- <url><loc>https://zndr.dk/about.html</loc></url>
+ <url><loc>https://zndr.dk/about/</loc></url>
</urlset>