schmelczer-dev/astro.config.mjs

52 lines
1.2 KiB
JavaScript

import sitemap from '@astrojs/sitemap';
import { defineConfig } from 'astro/config';
import rehypeAutolinkHeadings from 'rehype-autolink-headings';
import rehypeSlug from 'rehype-slug';
export default defineConfig({
site: 'https://schmelczer.dev',
trailingSlash: 'always',
redirects: {
'/writing/': '/articles/',
'/writing/[slug]': '/articles/[slug]',
},
integrations: [
sitemap({
filter: (page) => {
const path = new URL(page).pathname;
return !path.startsWith('/writing/') && path !== '/404/';
},
serialize(item) {
return { ...item, changefreq: 'monthly' };
},
}),
],
image: {
service: { entrypoint: 'astro/assets/services/sharp' },
},
markdown: {
shikiConfig: {
themes: {
light: 'github-light',
dark: 'github-dark',
},
defaultColor: false,
wrap: false,
},
rehypePlugins: [
rehypeSlug,
[
rehypeAutolinkHeadings,
{
behavior: 'append',
properties: {
className: ['heading-anchor'],
'aria-hidden': 'true',
tabIndex: -1,
},
content: { type: 'text', value: '#' },
},
],
],
},
});