Added 11ty-navigation plugin

This commit is contained in:
kalanggam 2023-10-19 21:31:19 -05:00
parent 6b8dfa650c
commit 41b0ae5504
10 changed files with 35 additions and 19 deletions

View file

@ -1,6 +1,9 @@
const eleventyNavigationPlugin = require("@11ty/eleventy-navigation");
const { DateTime } = require("luxon"); const { DateTime } = require("luxon");
module.exports = function (eleventyConfig) { module.exports = function (eleventyConfig) {
eleventyConfig.addPlugin(eleventyNavigationPlugin);
eleventyConfig.addFilter("postDate", (dateObj) => { eleventyConfig.addFilter("postDate", (dateObj) => {
return DateTime.fromJSDate(dateObj).toFormat("y'-'LL'-'dd' at 'T"); return DateTime.fromJSDate(dateObj).toFormat("y'-'LL'-'dd' at 'T");
}); });

14
package-lock.json generated
View file

@ -10,6 +10,7 @@
"license": "ISC", "license": "ISC",
"devDependencies": { "devDependencies": {
"@11ty/eleventy": "^2.0.1", "@11ty/eleventy": "^2.0.1",
"@11ty/eleventy-navigation": "^0.3.5",
"luxon": "^3.4.3" "luxon": "^3.4.3"
} }
}, },
@ -104,6 +105,19 @@
"url": "https://opencollective.com/11ty" "url": "https://opencollective.com/11ty"
} }
}, },
"node_modules/@11ty/eleventy-navigation": {
"version": "0.3.5",
"resolved": "https://registry.npmjs.org/@11ty/eleventy-navigation/-/eleventy-navigation-0.3.5.tgz",
"integrity": "sha512-4aKW5aIQDFed8xs1G1pWcEiFPcDSwZtA4IH1eERtoJ+Xy+/fsoe0pzbDmw84bHZ9ACny5jblENhfZhcCxklqQw==",
"dev": true,
"dependencies": {
"dependency-graph": "^0.11.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/11ty"
}
},
"node_modules/@11ty/eleventy-utils": { "node_modules/@11ty/eleventy-utils": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/@11ty/eleventy-utils/-/eleventy-utils-1.0.2.tgz", "resolved": "https://registry.npmjs.org/@11ty/eleventy-utils/-/eleventy-utils-1.0.2.tgz",

View file

@ -12,6 +12,7 @@
"license": "ISC", "license": "ISC",
"devDependencies": { "devDependencies": {
"@11ty/eleventy": "^2.0.1", "@11ty/eleventy": "^2.0.1",
"@11ty/eleventy-navigation": "^0.3.5",
"luxon": "^3.4.3" "luxon": "^3.4.3"
} }
} }

View file

@ -3,6 +3,7 @@
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="generator" content="{{ eleventy.generator }}">
<title>{% if title %}{{ title }} | {% endif %}{{ meta.siteName }}</title> <title>{% if title %}{{ title }} | {% endif %}{{ meta.siteName }}</title>
<link rel="stylesheet" href="/css/global.css" /> <link rel="stylesheet" href="/css/global.css" />
</head> </head>

View file

@ -1,3 +1,7 @@
<header> <header>
<h1>{{ title or meta.siteName }}</h1> <h1>{{ title or meta.siteName }}</h1>
<hr>
<h2>Navigation</h2>
{{ collections.all | eleventyNavigation | eleventyNavigationToHtml | safe }}
<hr>
</header> </header>

View file

@ -1,6 +1,6 @@
--- ---
title: Cebuano title: Cebuano
layout: page.njk layout: page.njk
eleventyNavigation:
key: Cebuano
--- ---
[&larr; Home](/)

View file

@ -1,19 +1,12 @@
--- ---
layout: page.njk layout: page.njk
date: Last Modified date: Last Modified
eleventyNavigation:
key: Home
order: -1
--- ---
hello! my name is gil and this is my site. pronouns are he/they. i write and tinker with software/hardware. i don't have much to put here except links (for now). Hello! my name is gil and this is my site. pronouns are he/they. i write and tinker with software/hardware. i don't have much to put here except links (for now).
---
## Here
[Cebuano](/ceb/)
[Now](/now/)
[Poetry](/poetry/)
---
## Links ## Links

View file

@ -1,8 +1,8 @@
--- ---
title: Now title: Now
layout: page.njk layout: page.njk
eleventyNavigation:
key: Now
--- ---
Hello! Hello!
[&larr; Home](/)

View file

@ -3,6 +3,8 @@ title: Poetry
layout: page.njk layout: page.njk
permalink: /poetry/index.html permalink: /poetry/index.html
override:tags: [] override:tags: []
eleventyNavigation:
key: Poetry
--- ---
<ul> <ul>
@ -10,5 +12,3 @@ override:tags: []
<li><a href="{{ poem.url }}">{{ poem.data.title }}</a></li> <li><a href="{{ poem.url }}">{{ poem.data.title }}</a></li>
{%- endfor -%} {%- endfor -%}
</ul> </ul>
[&larr; Home](/)

View file

@ -1,5 +1,5 @@
{ {
"layout": "page.njk", "layout": "page.njk",
"permalink": "/poem/{{ page.fileSlug }}/", "permalink": "/poem/{{ title | slug }}/",
"tags": "poems" "tags": "poems"
} }