feat: support disable blog module

This commit is contained in:
javayhu 2025-08-15 22:20:15 +08:00
parent 46fd529390
commit 866988d73c
5 changed files with 90 additions and 76 deletions

View File

@ -14,7 +14,6 @@ type Href = Parameters<typeof getLocalePathname>[0]['href'];
const staticRoutes = [
'/',
'/pricing',
'/blog',
'/docs',
'/about',
'/contact',
@ -48,6 +47,8 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
})
);
// add blog related routes if enabled
if (websiteConfig.blog.enable) {
// add categories
sitemapList.push(
...categorySource.getPages().flatMap((category) =>
@ -130,6 +131,7 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
}))
)
);
}
// add docs
const docsParams = source.generateParams();

View File

@ -3,6 +3,7 @@
import { Routes } from '@/routes';
import type { NestedMenuItem } from '@/types';
import { useTranslations } from 'next-intl';
import { websiteConfig } from './website';
/**
* Get footer config with translations
@ -41,11 +42,15 @@ export function getFooterLinks(): NestedMenuItem[] {
{
title: t('resources.title'),
items: [
...(websiteConfig.blog.enable
? [
{
title: t('resources.items.blog'),
href: Routes.Blog,
external: false,
},
]
: []),
{
title: t('resources.items.docs'),
href: Routes.Docs,

View File

@ -34,6 +34,7 @@ import {
WandSparklesIcon,
} from 'lucide-react';
import { useTranslations } from 'next-intl';
import { websiteConfig } from './website';
/**
* Get navbar config with translations
@ -59,11 +60,15 @@ export function getNavbarLinks(): NestedMenuItem[] {
href: Routes.Pricing,
external: false,
},
...(websiteConfig.blog.enable
? [
{
title: t('blog.title'),
href: Routes.Blog,
external: false,
},
]
: []),
{
title: t('docs.title'),
href: Routes.Docs,

View File

@ -34,12 +34,12 @@ export const websiteConfig: WebsiteConfig = {
},
features: {
enableDiscordWidget: false,
enableCrispChat: process.env.NEXT_PUBLIC_DEMO_WEBSITE === 'true',
enableUpgradeCard: true,
enableUpdateAvatar: true,
enableAffonsoAffiliate: false,
enablePromotekitAffiliate: false,
enableDatafastRevenueTrack: false,
enableCrispChat: process.env.NEXT_PUBLIC_DEMO_WEBSITE === 'true',
enableTurnstileCaptcha: process.env.NEXT_PUBLIC_DEMO_WEBSITE === 'true',
},
routes: {
@ -68,6 +68,7 @@ export const websiteConfig: WebsiteConfig = {
},
},
blog: {
enable: false,
paginationSize: 6,
relatedPostsSize: 3,
},

View File

@ -111,6 +111,7 @@ export interface I18nConfig {
* Blog configuration
*/
export interface BlogConfig {
enable: boolean; // Whether to enable the blog
paginationSize: number; // Number of posts per page
relatedPostsSize: number; // Number of related posts to show
}