miom.space/_config.ts
Benjamin Yule Bädorf 8341c079f8
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
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
2024-04-14 15:02:49 +02:00

61 lines
1.3 KiB
TypeScript

import lume from "lume/mod.ts";
import inline from "lume/plugins/inline.ts";
import postcss from "lume/plugins/postcss.ts";
const markdown = { options: { breaks: true } };
const site = lume({}, { markdown });
site.use(inline());
const languages = [
{
name: 'deutsch',
slug: 'de',
urlPrefix: '',
},
{
name: 'english',
slug: 'en',
urlPrefix: 'en',
}
]
site.data('languages', languages);
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];
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([ ".js" ]);
site.copy("fonts");
site.copy("img");
site.filter("title", (value = '') => value + (value ? " | " : "") + "MiOM");
site.ignore(
".direnv",
"README.md",
"CHANGELOG.md",
"LICENSE.md",
"docker-compose.yml",
);
export default site;