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