Added 11ty to publish mds dropped by micropub to pages
Here goes nothing...
This commit is contained in:
parent
73dbb03949
commit
dc5ca0d0bd
12 changed files with 2941 additions and 1 deletions
39
.eleventy.js
Normal file
39
.eleventy.js
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
module.exports = function(eleventyConfig) {
|
||||||
|
|
||||||
|
eleventyConfig.addFilter("formatDate", function(value) {
|
||||||
|
try{
|
||||||
|
const date = new Date(value)
|
||||||
|
if(date) return date.toISOString().replace('T', ' ').slice(0, -5)
|
||||||
|
else throw 'Unrecognized data format'
|
||||||
|
}
|
||||||
|
catch(e) {
|
||||||
|
console.log(`Could not convert "${value}"`, e)
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
eleventyConfig.addFilter("dateISOString", function(value) {
|
||||||
|
try{
|
||||||
|
const date = new Date(value)
|
||||||
|
if(date) return date.toISOString()
|
||||||
|
else throw 'Unrecognized data format'
|
||||||
|
}
|
||||||
|
catch(e) {
|
||||||
|
console.log(`Could not convert "${value}"`, e)
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
eleventyConfig.addCollection("notes", function(collectionApi) {
|
||||||
|
return collectionApi.getFilteredByGlob("_content/notes/*.md").reverse();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Return your Object options:
|
||||||
|
return {
|
||||||
|
dir: {
|
||||||
|
input: "_content",
|
||||||
|
output: "pub"
|
||||||
|
},
|
||||||
|
templateFormats: ["md","html"]
|
||||||
|
}
|
||||||
|
};
|
27
.github/workflows/eleventy_build.yml
vendored
Normal file
27
.github/workflows/eleventy_build.yml
vendored
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
name: Eleventy Build
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Setup Node
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: '10.x'
|
||||||
|
|
||||||
|
- run: npm ci
|
||||||
|
|
||||||
|
- run: npm run build
|
||||||
|
|
||||||
|
- name: Deploy
|
||||||
|
uses: peaceiris/actions-gh-pages@v3
|
||||||
|
with:
|
||||||
|
deploy_key: $
|
||||||
|
publish_dir: ./pub
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
node_modules
|
0
.nojekyll
Normal file
0
.nojekyll
Normal file
33
_content/_includes/layout.njk
Normal file
33
_content/_includes/layout.njk
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
---
|
||||||
|
title: Mon Repos (Death's Domain)
|
||||||
|
---
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||||
|
<meta name="mobile-web-app-capable" content="yes" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<link rel="icon" type="image/svg+xml" href="img/avatar-tt.svg">
|
||||||
|
<link rel="icon" type="image/png" href="img/avatar-tiny.png">
|
||||||
|
<link rel="authorization_endpoint" href="https://indieauth.com/auth">
|
||||||
|
<link rel="token_endpoint" href="https://tokens.indieauth.com/token">
|
||||||
|
<link rel="webmention" href="https://webmention.io/death.id.au/webmention" />
|
||||||
|
<link rel="pingback" href="https://webmention.io/death.id.au/xmlrpc" />
|
||||||
|
<link rel="microsub" href="https://aperture.p3k.io/microsub/807">
|
||||||
|
<link rel="micropub" href="https://micropub.death.id.au/.netlify/functions/micropub">
|
||||||
|
<link rel="micropub_media" href="https://micropub.death.id.au/.netlify/functions/media">
|
||||||
|
<link rel="stylesheet" href="/styles.css">
|
||||||
|
<title>{{ title }}</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<article class="{{ type }}">
|
||||||
|
<time class="dt-published" datetime="{{ date }}">{{ date | formatDate }}</time>
|
||||||
|
<div class="e-content">
|
||||||
|
{{ content | safe }}
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
42
_content/notes.html
Normal file
42
_content/notes.html
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
---
|
||||||
|
title: Mon Repos (Death's Domain)
|
||||||
|
---
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||||
|
<meta name="mobile-web-app-capable" content="yes" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<link rel="icon" type="image/svg+xml" href="img/avatar-tt.svg">
|
||||||
|
<link rel="icon" type="image/png" href="img/avatar-tiny.png">
|
||||||
|
<link rel="authorization_endpoint" href="https://indieauth.com/auth">
|
||||||
|
<link rel="token_endpoint" href="https://tokens.indieauth.com/token">
|
||||||
|
<link rel="webmention" href="https://webmention.io/death.id.au/webmention" />
|
||||||
|
<link rel="pingback" href="https://webmention.io/death.id.au/xmlrpc" />
|
||||||
|
<link rel="microsub" href="https://aperture.p3k.io/microsub/807">
|
||||||
|
<link rel="micropub" href="https://micropub.death.id.au/.netlify/functions/micropub">
|
||||||
|
<link rel="micropub_media" href="https://micropub.death.id.au/.netlify/functions/media">
|
||||||
|
<link rel="stylesheet" href="../../styles.css">
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/luxon/build/global/luxon.min.js" crossorigin="anonymous"></script>
|
||||||
|
<title>{{ title }}</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<main>
|
||||||
|
<ol class="h-notes">
|
||||||
|
{%- for note in collections.notes -%}
|
||||||
|
|
||||||
|
<li class="{{ note.data.type }}" role="article">
|
||||||
|
<time class="dt-published" datetime="{{ note.data.date }}">{{ note.data.date | formatDate }}</time>
|
||||||
|
<div class="e-content">
|
||||||
|
{{ note.templateContent }}
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
{%- endfor -%}
|
||||||
|
</ol>
|
||||||
|
</main>
|
||||||
|
</body>
|
||||||
|
<script src="../../js/relative-time.js"></script>
|
||||||
|
</html>
|
6
_content/notes/1669767188.md
Normal file
6
_content/notes/1669767188.md
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
type: h-entry
|
||||||
|
date: '2022-11-30T01:14:08.945Z'
|
||||||
|
client_id: 'https://gimme-a-token.5eb.nl/'
|
||||||
|
---
|
||||||
|
Does it support multiple?
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
type: h-entry
|
type: h-entry
|
||||||
date: '2022-11-30T00:13:08.945Z'
|
date: '2022-11-30T00:16:08.945Z'
|
||||||
client_id: 'https://gimme-a-token.5eb.nl/'
|
client_id: 'https://gimme-a-token.5eb.nl/'
|
||||||
---
|
---
|
||||||
does it work?
|
does it work?
|
1
_content/notes/notes.json
Normal file
1
_content/notes/notes.json
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{ "layout": "layout.njk" }
|
6
js/relative-time.js
Normal file
6
js/relative-time.js
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
document.querySelectorAll('time').forEach(time => {
|
||||||
|
const datetime = luxon.DateTime.fromISO(time.getAttribute('datetime'))
|
||||||
|
time.innerText = datetime.toRelative()
|
||||||
|
});
|
||||||
|
}, false);
|
2762
package-lock.json
generated
Normal file
2762
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
23
package.json
Normal file
23
package.json
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
{
|
||||||
|
"name": "death.id.au",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "This repository provides minimal HTML for starting a new web site!",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"build": "eleventy"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/deathau/deathau.github.io.git"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/deathau/deathau.github.io/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/deathau/deathau.github.io#readme",
|
||||||
|
"devDependencies": {
|
||||||
|
"@11ty/eleventy": "^1.0.2"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue