pub.solar/_config.ts
Benjamin Yule Bädorf e6279896d6
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
v2: initial commit
* Separate german and english language pages
* Add a services page with details per service
* Move hakken dates into the same container as the text
* Introductory text on the homepage
2024-03-06 16:34:00 +01:00

71 lines
1.4 KiB
TypeScript

import lume from "lume/mod.ts";
import sass from "lume/plugins/sass.ts";
import date from "lume/plugins/date.ts";
import jsx from "lume/plugins/jsx.ts";
import terser from "lume/plugins/terser.ts";
import postcss from "lume/plugins/postcss.ts";
const site = lume();
const languages = [
{
name: 'deutsch',
slug: 'de',
urlPrefix: 'de',
},
{
name: 'english',
slug: 'en',
urlPrefix: '',
},
];
site.data('languages', languages);
site.preprocess([ '.yml' ], (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(sass());
site.use(date());
site.use(jsx());
site.use(terser());
site.use(postcss());
site.loadAssets([
".png",
".jpg",
".svg",
".pdf",
".woff2",
".woff",
".ttf",
".otf",
".js",
".txt",
]);
site.ignore(
".direnv",
"README.md",
"CHANGELOG.md",
"LICENSE.md",
"docker-compose.yml",
);
export default site;