feat: support disable docs module
This commit is contained in:
parent
866988d73c
commit
a1ae6ca384
@ -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;
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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: [
|
||||
|
@ -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>',
|
||||
|
8
src/types/index.d.ts
vendored
8
src/types/index.d.ts
vendored
@ -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
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user