Added 11ty to publish mds dropped by micropub to pages

Here goes nothing...
This commit is contained in:
Gordon Pedersen 2022-11-30 16:48:51 +11:00
parent 73dbb03949
commit dc5ca0d0bd
12 changed files with 2941 additions and 1 deletions

39
.eleventy.js Normal file
View 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
View 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
View file

@ -0,0 +1 @@
node_modules

0
.nojekyll Normal file
View file

View 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
View 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>

View 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?

View file

@ -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?

View file

@ -0,0 +1 @@
{ "layout": "layout.njk" }

6
js/relative-time.js Normal file
View 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

File diff suppressed because it is too large Load diff

23
package.json Normal file
View 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"
}
}