feat: support disable docs module

This commit is contained in:
javayhu 2025-08-15 22:23:28 +08:00
parent 866988d73c
commit a1ae6ca384
5 changed files with 46 additions and 24 deletions

View File

@ -14,7 +14,6 @@ type Href = Parameters<typeof getLocalePathname>[0]['href'];
const staticRoutes = [
'/',
'/pricing',
'/docs',
'/about',
'/contact',
'/waitlist',
@ -24,6 +23,8 @@ const staticRoutes = [
'/cookie',
'/auth/login',
'/auth/register',
...(websiteConfig.blog.enable ? ['/blog'] : []),
...(websiteConfig.docs.enable ? ['/docs'] : []),
];
/**
@ -133,18 +134,20 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
);
}
// add docs
const docsParams = source.generateParams();
sitemapList.push(
...docsParams.flatMap((param) =>
routing.locales.map((locale) => ({
url: getUrl(`/docs/${param.slug.join('/')}`, locale),
lastModified: new Date(),
priority: 0.8,
changeFrequency: 'weekly' as const,
}))
)
);
// add docs related routes if enabled
if (websiteConfig.docs.enable) {
const docsParams = source.generateParams();
sitemapList.push(
...docsParams.flatMap((param) =>
routing.locales.map((locale) => ({
url: getUrl(`/docs/${param.slug.join('/')}`, locale),
lastModified: new Date(),
priority: 0.8,
changeFrequency: 'weekly' as const,
}))
)
);
}
return sitemapList;
}

View File

@ -51,11 +51,15 @@ export function getFooterLinks(): NestedMenuItem[] {
},
]
: []),
{
title: t('resources.items.docs'),
href: Routes.Docs,
external: false,
},
...(websiteConfig.docs.enable
? [
{
title: t('resources.items.docs'),
href: Routes.Docs,
external: false,
},
]
: []),
{
title: t('resources.items.changelog'),
href: Routes.Changelog,

View File

@ -69,11 +69,15 @@ export function getNavbarLinks(): NestedMenuItem[] {
},
]
: []),
{
title: t('docs.title'),
href: Routes.Docs,
external: false,
},
...(websiteConfig.docs.enable
? [
{
title: t('docs.title'),
href: Routes.Docs,
external: false,
},
]
: []),
{
title: t('ai.title'),
items: [

View File

@ -68,10 +68,13 @@ export const websiteConfig: WebsiteConfig = {
},
},
blog: {
enable: false,
enable: true,
paginationSize: 6,
relatedPostsSize: 3,
},
docs: {
enable: true,
},
mail: {
provider: 'resend',
fromEmail: 'MkSaaS <support@mksaas.com>',

View File

@ -13,6 +13,7 @@ export type WebsiteConfig = {
auth: AuthConfig;
i18n: I18nConfig;
blog: BlogConfig;
docs: DocsConfig;
mail: MailConfig;
newsletter: NewsletterConfig;
storage: StorageConfig;
@ -116,6 +117,13 @@ export interface BlogConfig {
relatedPostsSize: number; // Number of related posts to show
}
/**
* Docs configuration
*/
export interface DocsConfig {
enable: boolean; // Whether to enable the docs
}
/**
* Mail configuration
*/