1
0
ultimatedocs/docs/.vitepress/config/index.ts
2024-06-29 17:25:20 +02:00

165 lines
5.0 KiB
TypeScript

import { Content, defineConfig, HeadConfig } from 'vitepress'
import { SitemapStream } from 'sitemap'
import { createWriteStream } from 'node:fs'
import { resolve } from 'node:path'
import { withMermaid } from "vitepress-plugin-mermaid";
import timeline from "vitepress-markdown-timeline";
import markfootnote from 'markdown-it-footnote';
import { SchemaOrgResolver } from '@vueuse/schema-org'
import { enConfig } from './en'
import { nlConfig } from './nl'
// https://vitepress.dev/reference/site-config
// https://github.com/emersonbottero/vitepress-plugin-mermaid/tree/main
const links = []
export default withMermaid(
defineConfig({
transformHead: ({ pageData }) => {
const head: HeadConfig[] = []
head.push(['meta', { property: 'og:title', content: pageData.frontmatter.title }])
head.push(['meta', { property: 'og:description', content: pageData.frontmatter.description }])
head.push(['meta', { property: 'title', content: pageData.title}])
head.push(['meta', { property: 'og:type', content: "website " }])
head.push(['meta', { name: 'applicable-device', content: "pc,mobile" }])
head.push(['meta', { name: 'theme-color', content: "#ffffff" }])
head.push(['meta', { name: 'color-scheme', content: "dark light" }])
head.push(['meta', { name: 'apple-mobile-web-app-status-bar-style', content: "lack-translucent" }])
//head.push(['meta', { name: 'keywords', content: pageData.frontmatter.meta_keywords }])
//head.push(['meta', { property: 'og:url', content: pageData.frontmatter.meta_url }])
head.push(['meta', { name: 'og:locale', alternate: "nl_NL" }])
head.push(['meta', { name: 'og:locale', alternate: "en_US" }])
head.push(['meta', { name: 'og:locale', alternate: "en_GB" }])
head.push(['meta', { property: 'og:locale', alternate: pageData.frontmatter.meta_url }])
// head.push(['link', { rel: 'alternate', content: "`https://Ultimatekingdom.nlfeed.rss" , type: "application/rss" }])
return head
},
//sitemap
transformHtml: (_, id, { pageData }) => {
if (!/[\\/]404\.html$/.test(id))
links.push({
// you might need to change this if not using clean urls mode
url: pageData.relativePath.replace(/((^|\/)index)?\.md$/, '$2'),
lastmod: pageData.lastUpdated
})
},
buildEnd: async ({ outDir }) => {
const sitemap = new SitemapStream({
hostname: 'https://Ultimatekingdom.nl/'
})
const writeStream = createWriteStream(resolve(outDir, 'sitemap.xml'))
sitemap.pipe(writeStream)
links.forEach((link) => sitemap.write(link))
sitemap.end()
await new Promise((r) => writeStream.on('finish', r))
},
lastUpdated: false,
cleanUrls: true,
locales: {
root: {
label: 'Nederlands',
lang: 'nl',
...nlConfig,
},
en: {
label: 'English',
lang: 'en',
link: '/en/',
...enConfig,
},
},
markdown: {
config: (md) => {
md.use(timeline);
md.use(markfootnote)
},
// theme: "material-palenight",
lineNumbers: false,
},
themeConfig: {
nav: nav(),
// langMenuLabel: "kies taal",
footer: {
message: "UltimateKingdom.nl",
copyright: "Copyright © 2022-present RecoreHosting",
},
socialLinks: [
{ icon: "github", link: "https://git.recorehosting.com/" },
{ icon: "discord", link: "https://discord.gg/t3sFuDc6xz" },
],
search: {
provider: 'local',
options: {
translations: {
button: {
buttonText: 'Zoeken',
buttonAriaLabel: 'Zoeken',
},
modal: {
noResultsText: 'geen resultaten voor',
resetButtonTitle: 'reset',
footer: {
selectText: 'te selecteren',
navigateText: 'te navigeren',
},
},
},
locales: {
en: {
translations: {
button: {
buttonText: 'Search',
buttonAriaLabel: 'Search',
},
modal: {
noResultsText: 'No results for',
resetButtonTitle: 'Reset search',
footer: {
selectText: 'to select',
navigateText: 'to navigate',
},
},
},
},
}
}
}// end
}
})
)
function nav() {
return [
{ text: "latest-KingdomPlugin: 2.12.12.1-RC", link: "https://jenkins.recorehosting.com/job/UltimateKingdom-2.XX/"},
{ text: "latest-exchangePlugin: 2.12.3.1-RC", link: "https://jenkins.recorehosting.com/job/Exchange_2.x/"},
{ text: 'API', link: '/API' },
{ text: 'Changelog', link: '/changelog' },
{ text: "JavaDocs", link: "https://jenkins.recorehosting.com/job/UltimateKingdom-2.XX/javadoc/" },
]
}