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

View File

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

View File

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

View File

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

View File

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