mirror of
https://github.com/reonokiy/blog.nokiy.net.git
synced 2025-06-15 19:22:52 +02:00
80 lines
1.9 KiB
TypeScript
80 lines
1.9 KiB
TypeScript
import mdx from '@astrojs/mdx'
|
|
import partytown from '@astrojs/partytown'
|
|
import sitemap from '@astrojs/sitemap'
|
|
import compress from 'astro-compress'
|
|
import robotsTxt from 'astro-robots-txt'
|
|
import { defineConfig } from 'astro/config'
|
|
import rehypeExternalLinks from 'rehype-external-links'
|
|
import rehypeKatex from 'rehype-katex'
|
|
import remarkMath from 'remark-math'
|
|
import UnoCSS from 'unocss/astro'
|
|
import { themeConfig } from './src/config'
|
|
import { langMap } from './src/i18n/config'
|
|
import { remarkReadingTime } from './src/plugins/remark-reading-time'
|
|
|
|
const url = themeConfig.site.url
|
|
const locale = themeConfig.global.locale
|
|
const linkPrefetch = themeConfig.preload.linkPrefetch
|
|
const imageDomain = new URL(themeConfig.preload.imageHostURL as string).hostname
|
|
|
|
export default defineConfig({
|
|
site: url,
|
|
base: '/',
|
|
trailingSlash: 'always',
|
|
prefetch: {
|
|
prefetchAll: true,
|
|
defaultStrategy: linkPrefetch,
|
|
},
|
|
image: {
|
|
domains: [imageDomain],
|
|
remotePatterns: [{ protocol: 'https' }],
|
|
},
|
|
i18n: {
|
|
locales: Object.entries(langMap).map(([path, codes]) => ({
|
|
path,
|
|
codes: codes as [string, ...string[]],
|
|
})),
|
|
defaultLocale: locale,
|
|
},
|
|
integrations: [
|
|
UnoCSS({
|
|
injectReset: true,
|
|
}),
|
|
mdx(),
|
|
partytown({
|
|
config: {
|
|
forward: ['dataLayer.push'],
|
|
},
|
|
}),
|
|
sitemap(),
|
|
robotsTxt(),
|
|
compress(),
|
|
],
|
|
markdown: {
|
|
remarkPlugins: [
|
|
remarkMath,
|
|
remarkReadingTime,
|
|
],
|
|
rehypePlugins: [
|
|
rehypeKatex,
|
|
[
|
|
rehypeExternalLinks,
|
|
{
|
|
target: '_blank',
|
|
rel: ['nofollow', 'noopener', 'noreferrer', 'external'],
|
|
protocols: ['http', 'https', 'mailto'],
|
|
},
|
|
],
|
|
],
|
|
// available themes: https://shiki.style/themes
|
|
shikiConfig: {
|
|
themes: {
|
|
light: 'one-light',
|
|
dark: 'one-dark-pro',
|
|
},
|
|
},
|
|
},
|
|
devToolbar: {
|
|
enabled: false,
|
|
},
|
|
})
|