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([ '.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); } 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 }); site.use(postcss()); site.loadAssets([ ".png", ".jpg", ".svg", ".pdf", ".woff2", ".woff", ".ttf", ".otf", ".js", ".txt", ]); 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", "CHANGELOG.md", "LICENSE.md", "docker-compose.yml", ); export default site;