From 8341c079f828f8d1fb36e0946e922fc005e3934f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Yule=20B=C3=A4dorf?= Date: Sun, 14 Apr 2024 14:54:42 +0200 Subject: [PATCH] lume: update to v2 * Update lume to v2 * Update deno to v1.41.3 * Use vento instead of nunjucks for templating * Use markdown for page data * Fix english translation of homepage * Fix asset build * Make images responsive --- .drone.yml | 2 +- Dockerfile | 2 +- README.md | 2 +- _config.ts | 50 +- _includes/{border.njk => border.vto} | 0 .../{layouts/default.njk => default.vto} | 26 +- _includes/homepage.vto | 37 + _includes/layouts/homepage.njk | 27 - _includes/{navigation.njk => navigation.vto} | 20 +- _includes/text.vto | 7 + build.sh | 11 - collaborate.md | 16 + collaborate.yml | 16 - collective.md | 14 + collective.yml | 14 - contact.md | 10 + contact.yml | 10 - deno.json | 15 +- deno.lock | 1618 +++++++++++++---- en/collaborate.md | 16 + en/collaborate.yml | 16 - en/collective.md | 14 + en/collective.yml | 14 - en/contact.md | 10 + en/contact.yml | 10 - en/{imprint.yml => imprint.md} | 7 +- en/index.md | 32 + en/index.yml | 29 - en/{privacy-policy.yml => privacy-policy.md} | 7 +- en/projects.md | 33 + en/projects.yml | 33 - en/space.md | 31 + en/space.yml | 31 - flake.lock | 18 +- img/home-aussenchill-500.jpg | Bin 0 -> 77227 bytes img/home-aussenchill-700.jpg | Bin 0 -> 138176 bytes img/{aussenchill.jpg => home-aussenchill.jpg} | Bin img/home-crowd-500.jpg | Bin 0 -> 56513 bytes img/home-crowd-700.jpg | Bin 0 -> 93549 bytes img/{crowd.jpg => home-crowd.jpg} | Bin img/home-hakken-500.jpg | Bin 0 -> 132487 bytes img/home-hakken-700.jpg | Bin 0 -> 211298 bytes img/{hakken.jpeg => home-hakken.jpg} | Bin img/home-werkstatt-500.jpg | Bin 0 -> 89241 bytes img/home-werkstatt-700.jpg | Bin 0 -> 143069 bytes img/{werkstatt.jpg => home-werkstatt.jpg} | Bin img/logo-1000.jpg | Bin 0 -> 1447519 bytes img/logo-500.jpg | Bin 0 -> 312332 bytes img/logo-700.jpg | Bin 0 -> 650474 bytes ....jpeg => signal-2023-03-02-144400_020.jpg} | Bin imprint.yml => imprint.md | 7 +- index.yml => index.md | 18 +- privacy-policy.yml => privacy-policy.md | 7 +- projects.md | 32 + projects.yml | 32 - space.md | 23 + space.yml | 23 - 57 files changed, 1656 insertions(+), 684 deletions(-) rename _includes/{border.njk => border.vto} (100%) rename _includes/{layouts/default.njk => default.vto} (61%) create mode 100644 _includes/homepage.vto delete mode 100644 _includes/layouts/homepage.njk rename _includes/{navigation.njk => navigation.vto} (69%) create mode 100644 _includes/text.vto delete mode 100755 build.sh create mode 100644 collaborate.md delete mode 100644 collaborate.yml create mode 100644 collective.md delete mode 100644 collective.yml create mode 100644 contact.md delete mode 100644 contact.yml create mode 100644 en/collaborate.md delete mode 100644 en/collaborate.yml create mode 100644 en/collective.md delete mode 100644 en/collective.yml create mode 100644 en/contact.md delete mode 100644 en/contact.yml rename en/{imprint.yml => imprint.md} (89%) create mode 100644 en/index.md delete mode 100644 en/index.yml rename en/{privacy-policy.yml => privacy-policy.md} (82%) create mode 100644 en/projects.md delete mode 100644 en/projects.yml create mode 100644 en/space.md delete mode 100644 en/space.yml create mode 100644 img/home-aussenchill-500.jpg create mode 100644 img/home-aussenchill-700.jpg rename img/{aussenchill.jpg => home-aussenchill.jpg} (100%) create mode 100644 img/home-crowd-500.jpg create mode 100644 img/home-crowd-700.jpg rename img/{crowd.jpg => home-crowd.jpg} (100%) create mode 100644 img/home-hakken-500.jpg create mode 100644 img/home-hakken-700.jpg rename img/{hakken.jpeg => home-hakken.jpg} (100%) create mode 100644 img/home-werkstatt-500.jpg create mode 100644 img/home-werkstatt-700.jpg rename img/{werkstatt.jpg => home-werkstatt.jpg} (100%) create mode 100644 img/logo-1000.jpg create mode 100644 img/logo-500.jpg create mode 100644 img/logo-700.jpg rename img/{signal-2023-03-02-144400_020.jpeg => signal-2023-03-02-144400_020.jpg} (100%) rename imprint.yml => imprint.md (89%) rename index.yml => index.md (60%) rename privacy-policy.yml => privacy-policy.md (85%) create mode 100644 projects.md delete mode 100644 projects.yml create mode 100644 space.md delete mode 100644 space.yml diff --git a/.drone.yml b/.drone.yml index 8fa519a..101390e 100644 --- a/.drone.yml +++ b/.drone.yml @@ -10,7 +10,7 @@ steps: - pull_request image: denoland/deno:alpine-1.40.2 commands: - - ./build.sh + - deno task build - name: publish when: diff --git a/Dockerfile b/Dockerfile index 1f5bed7..cc85328 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM denoland/deno:alpine-1.34.3 as build-stage +FROM denoland/deno:alpine-1.41.3 as build-stage WORKDIR /app diff --git a/README.md b/README.md index f5c71e6..f6e10d7 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ direnv allow Just build the static site, results are in `_site`: ``` -./build.sh +deno task build ``` To get a live development server, run: diff --git a/_config.ts b/_config.ts index 344df79..e4aad90 100644 --- a/_config.ts +++ b/_config.ts @@ -22,47 +22,33 @@ const languages = [ ] site.data('languages', languages); -site.preprocess([ '.yml' ], (page) => { - const urlParts = (page.data.url || '').replace(/^\/|\/$/g, '').split('/'); - const langPrefix = urlParts[0]; - const currentLang = (() => { - if (langPrefix.length === 2) { - return languages.find(lang => lang.urlPrefix === langPrefix); - } +site.preprocess([ '.md' ], (pages) => { + for (const page of pages) { + const urlParts = (page.data.url || '').replace(/^\/|\/$/g, '').split('/'); + const langPrefix = urlParts[0]; + const currentLang = (() => { + if (langPrefix.length === 2) { + return languages.find(lang => lang.urlPrefix === langPrefix); + } - return languages.find(lang => lang.urlPrefix.length === 0); - })() || languages[0]; + return languages.find(lang => lang.urlPrefix.length === 0); + })() || languages[0]; - page.data.language = currentLang; - page.data.otherLang = languages.find(l => l.slug !== currentLang.slug); - page.data.baseURL = page.data.url.replace(new RegExp(`^\\/${currentLang.slug}`), ''); - - return page + page.data.language = currentLang; + page.data.otherLang = languages.find(l => l.slug !== currentLang.slug); + page.data.baseURL = page.data.url.replace(new RegExp(`^\\/${currentLang.slug}`), ''); + } }); site.use(postcss()); -site.loadAssets([ - ".png", - ".jpg", - ".svg", - ".pdf", - ".woff2", - ".woff", - ".ttf", - ".otf", - ".js", - ".txt", -]); +site.loadAssets([ ".js" ]); + +site.copy("fonts"); +site.copy("img"); site.filter("title", (value = '') => value + (value ? " | " : "") + "MiOM"); -site.filter("objectToArray", (value = {}) => Object.keys(value) - .sort() - .map(key => value[key]) - .filter(val => !!val) -); - site.ignore( ".direnv", "README.md", diff --git a/_includes/border.njk b/_includes/border.vto similarity index 100% rename from _includes/border.njk rename to _includes/border.vto diff --git a/_includes/layouts/default.njk b/_includes/default.vto similarity index 61% rename from _includes/layouts/default.njk rename to _includes/default.vto index f078a54..7a74914 100644 --- a/_includes/layouts/default.njk +++ b/_includes/default.vto @@ -2,7 +2,7 @@ - {{ title | title | safe }} + {{ title |> title |> safe }} @@ -14,27 +14,19 @@ - + - {% if extraStylesheets %} - {% for extraStylesheet in extraStylesheets %} + {{ if extraStylesheets }} + {{ for extraStylesheet of extraStylesheets }} - {% endfor %} - {% endif %} + {{ /for }} + {{ /if }} - {% include "border.njk" %} + {{ include "border.vto" }} - {% block navigation %} - {% include "navigation.njk" %} - {% endblock %} + {{ include "navigation.vto" }} - {% block main %} -
-

{{ title }}

- - {{ text | md | safe }} -
- {% endblock %} + {{ content }} diff --git a/_includes/homepage.vto b/_includes/homepage.vto new file mode 100644 index 0000000..d5ec444 --- /dev/null +++ b/_includes/homepage.vto @@ -0,0 +1,37 @@ +{{ layout 'default.vto' }} +
+ + +
+ {{ tagline |> md |> safe }} +
+ + {{ for card of cards }} + + + + + {{ card.image.alt }} + +
{{ card.text }}
+
+ {{ /for }} +
+{{ /layout }} diff --git a/_includes/layouts/homepage.njk b/_includes/layouts/homepage.njk deleted file mode 100644 index dc857ac..0000000 --- a/_includes/layouts/homepage.njk +++ /dev/null @@ -1,27 +0,0 @@ -{% extends 'layouts/default.njk' %} - -{% block main %} -
- - -
- {{ tagline | md | safe }} -
- - {% for card in cards %} - - {{ card.image.alt }} -
{{ card.text }}
-
- {% endfor %} -
-{% endblock %} diff --git a/_includes/navigation.njk b/_includes/navigation.vto similarity index 69% rename from _includes/navigation.njk rename to _includes/navigation.vto index fb30a8b..8f33d11 100644 --- a/_includes/navigation.njk +++ b/_includes/navigation.vto @@ -6,27 +6,27 @@ >_menu