Files
zitadel/apps/docs/next.config.mjs
T
Florian ForsterandGitHub 2700286ae7 docs: fix sidebar (#11479)
This pull request primarily updates dependencies in the documentation
app and the root package to keep them current and introduce new features
or bug fixes. The most notable changes are version bumps for several
core and UI-related packages, as well as the addition of new packages
related to syntax highlighting.

Dependency updates and additions:

* Updated `fumadocs-core`, `fumadocs-mdx`, and `fumadocs-ui` to version
`16.4.11`, `14.2.6`, and `16.4.11` respectively, and bumped
`fumadocs-openapi` to `^10.2.4` in `apps/docs/package.json` for improved
documentation features and bug fixes.
* Updated `next` and `eslint-config-next` to version `16.1.6` in
`apps/docs/package.json` for framework and linting improvements.
[[1]](diffhunk://#diff-d03d2ce97fad5059ad6248fca5f5919994b09bca360f883318c03f1f817ae677R27-R44)
[[2]](diffhunk://#diff-d03d2ce97fad5059ad6248fca5f5919994b09bca360f883318c03f1f817ae677L60-R62)
* Bumped `shiki` to `^3.21.0` in both `apps/docs/package.json` and the
root `package.json` for enhanced syntax highlighting.
[[1]](diffhunk://#diff-d03d2ce97fad5059ad6248fca5f5919994b09bca360f883318c03f1f817ae677R27-R44)
[[2]](diffhunk://#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519R19)

New package additions for syntax highlighting:

* Added `@shikijs/rehype` and `@shikijs/types` at version `^3.21.0` in
`apps/docs/package.json` to support advanced code highlighting in
documentation.
2026-01-30 18:11:12 +00:00

165 lines
4.5 KiB
JavaScript

import { createMDX } from 'fumadocs-mdx/next';
import { rehypeCode } from 'fumadocs-core/mdx-plugins';
import { promises as fs } from 'fs';
import { URL } from 'url';
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
basePath: '/docs',
outputFileTracingIncludes: {
'/**': ['./openapi/**/*', './content/**/*', './.source/**/*'],
},
async redirects() {
try {
const redirectsPath = new URL('./redirects.json', import.meta.url);
const redirectsContent = await fs.readFile(redirectsPath, 'utf-8');
const generatedRedirects = JSON.parse(redirectsContent);
return [
...generatedRedirects,
{
source: '/',
destination: '/docs',
basePath: false,
permanent: false,
},
{
source: '/img/:path*',
destination: '/docs/img/:path*',
basePath: false,
permanent: false,
},
];
} catch (e) {
console.warn('Could not load redirects.json', e);
return [
{
source: '/',
destination: '/docs',
basePath: false,
permanent: false,
},
{
source: '/img/:path*',
destination: '/docs/img/:path*',
basePath: false,
permanent: false,
},
];
}
},
async rewrites() {
return [
{
source: '/favicon.ico',
destination: 'https://zitadel.com/favicon.ico',
basePath: false,
},
{
source: '/mp/lib.min.js',
destination: 'https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js',
},
{
source: '/mp/lib.js',
destination: 'https://cdn.mxpnl.com/libs/mixpanel-2-latest.js',
},
{
source: '/mp/decide',
destination: 'https://decide.mixpanel.com/decide',
},
{
source: '/mp/:slug*',
destination: 'https://api-eu.mixpanel.com/:slug*',
},
{
source: '/pl/js/script.js',
destination: 'https://plausible.io/js/script.js',
},
{
source: '/pl/api/event',
destination: 'https://plausible.io/api/event',
},
];
},
async headers() {
return [
{
source: '/:path*',
headers: [
{
key: 'Content-Security-Policy',
value: `default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://www.youtube.com https://www.google.com/recaptcha/ https://www.gstatic.com/recaptcha/ https://www.gstatic.com/charts/ https://www.youtube.com/; child-src zitadel.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com https://www.gstatic.com/charts/ zitadel.com; font-src 'self' https://fonts.gstatic.com https://fonts.googleapis.com; object-src 'none'; connect-src 'self' https://raw.githubusercontent.com/zitadel/ https://api.inkeep.com https://api.io.inkeep.com https://www.youtube.com; frame-src https://www.youtube.com/ https://www.google.com/recaptcha/ https://recaptcha.google.com/recaptcha/; img-src 'self' https://raw.githubusercontent.com/devicons/devicon/master/icons/ https://i.ytimg.com https://yt3.ggpht.com data: `,
},
{
key: 'Strict-Transport-Security',
value: 'max-age=63072000; includeSubDomains; preload',
},
{
key: 'Permissions-Policy',
value: 'payment=(self "https://js.stripe.com")',
},
{
key: 'Referrer-Policy',
value: 'origin-when-cross-origin',
},
{
key: 'X-Frame-Options',
value: 'SAMEORIGIN',
},
{
key: 'X-Content-Type-Options',
value: 'nosniff',
},
{
key: 'X-XSS-Protection',
value: '1; mode=block',
},
],
},
];
},
turbopack: {
rules: {
'*.{go,yaml,Caddyfile,conf}': {
loaders: ['raw-loader'],
as: '*.js',
},
},
},
webpack: (config) => {
config.module.rules.push({
test: /\.(go|yaml|Caddyfile|conf)$/,
type: 'asset/source',
});
return config;
},
};
const withMDX = createMDX({
mdxOptions: {
rehypePlugins: [
[
rehypeCode,
{
langs: [
'bash',
'yaml',
'json',
'go',
'typescript',
'javascript',
'sql',
'prometheus',
'promql',
],
},
],
],
},
});
export default withMDX(nextConfig);