refactor: enhance content collections and update localization
- Modified the meta collection to include files with 'meta**.json' for improved matching. - Added new translation keys for 'blog' in English and Chinese localization files. - Updated social links in the layout to use the XTwitterIcon for consistency. - Adjusted image paths in the features page for better organization. - Removed unused LocaleSwitcher import from the footer component.
This commit is contained in:
parent
91f1d59b7c
commit
5636a917ef
@ -29,7 +29,7 @@ const docs = defineCollection({
|
||||
const metas = defineCollection({
|
||||
name: 'meta',
|
||||
directory: 'content/docs',
|
||||
include: '**/meta.json',
|
||||
include: '**/meta**.json',
|
||||
parser: 'json',
|
||||
schema: createMetaSchema,
|
||||
});
|
||||
|
@ -188,8 +188,9 @@
|
||||
"previousPage": "Previous",
|
||||
"nextPage": "Next",
|
||||
"chooseLanguage": "Select language",
|
||||
"title": "MkSaaS Docs",
|
||||
"homepage": "Homepage",
|
||||
"title": "MkSaaS Docs"
|
||||
"blog": "Blog"
|
||||
},
|
||||
"Marketing": {
|
||||
"navbar": {
|
||||
|
@ -184,8 +184,9 @@
|
||||
"previousPage": "上一页",
|
||||
"nextPage": "下一页",
|
||||
"chooseLanguage": "选择语言",
|
||||
"title": "MkSaaS文档",
|
||||
"homepage": "首页",
|
||||
"title": "MkSaaS 文档"
|
||||
"blog": "博客"
|
||||
},
|
||||
"Marketing": {
|
||||
"navbar": {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Icons } from '@/components/icons/icons';
|
||||
import { XTwitterIcon } from '@/components/icons/x';
|
||||
import { ModeSwitcher } from '@/components/layout/mode-switcher';
|
||||
import { Logo } from '@/components/logo';
|
||||
import { websiteConfig } from '@/config';
|
||||
@ -8,6 +8,7 @@ import { source } from '@/lib/docs/source';
|
||||
import { I18nProvider, Translations } from 'fumadocs-ui/i18n';
|
||||
import { DocsLayout } from 'fumadocs-ui/layouts/docs';
|
||||
import type { BaseLayoutProps } from 'fumadocs-ui/layouts/shared';
|
||||
import { BookIcon, HomeIcon } from 'lucide-react';
|
||||
import { Locale } from 'next-intl';
|
||||
import { getTranslations } from 'next-intl/server';
|
||||
import type { ReactNode } from 'react';
|
||||
@ -26,6 +27,20 @@ interface DocsLayoutProps {
|
||||
params: Promise<{ locale: Locale }>;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Configure navigation
|
||||
* https://fumadocs.vercel.app/docs/ui/navigation/links
|
||||
* https://fumadocs.vercel.app/docs/ui/navigation/sidebar
|
||||
*
|
||||
* example:
|
||||
* https://github.com/fuma-nama/fumadocs/blob/dev/apps/docs/app/layout.config.tsx
|
||||
*
|
||||
* 2. Organizing Pages
|
||||
* https://fumadocs.vercel.app/docs/ui/page-conventions
|
||||
*
|
||||
* example:
|
||||
* https://github.com/fuma-nama/fumadocs/blob/dev/apps/docs/content/docs/ui/meta.json
|
||||
*/
|
||||
export default async function DocsRootLayout({ children, params }: DocsLayoutProps) {
|
||||
const { locale } = await params;
|
||||
const t = await getTranslations({ locale, namespace: 'DocsPage' });
|
||||
@ -42,7 +57,7 @@ export default async function DocsRootLayout({ children, params }: DocsLayoutPro
|
||||
};
|
||||
|
||||
// Docs layout configurations
|
||||
const baseOptions: BaseLayoutProps = {
|
||||
const docsOptions: BaseLayoutProps = {
|
||||
i18n: docsI18nConfig,
|
||||
githubUrl: websiteConfig.social.github ?? undefined,
|
||||
nav: {
|
||||
@ -57,13 +72,20 @@ export default async function DocsRootLayout({ children, params }: DocsLayoutPro
|
||||
{
|
||||
text: t('homepage'),
|
||||
url: '/',
|
||||
active: 'nested-url',
|
||||
icon: <HomeIcon />,
|
||||
active: 'none',
|
||||
},
|
||||
{
|
||||
text: t('blog'),
|
||||
url: '/blog',
|
||||
icon: <BookIcon />,
|
||||
active: 'none',
|
||||
},
|
||||
...(websiteConfig.social.twitter
|
||||
? [
|
||||
{
|
||||
type: "icon" as const,
|
||||
icon: <Icons.x />,
|
||||
icon: <XTwitterIcon />,
|
||||
text: "X",
|
||||
url: websiteConfig.social.twitter,
|
||||
secondary: true,
|
||||
@ -84,7 +106,7 @@ export default async function DocsRootLayout({ children, params }: DocsLayoutPro
|
||||
locale={locale}
|
||||
translations={translations}
|
||||
>
|
||||
<DocsLayout tree={source.pageTree[locale]} {...baseOptions}>
|
||||
<DocsLayout tree={source.pageTree[locale]} {...docsOptions}>
|
||||
{children}
|
||||
</DocsLayout>
|
||||
</I18nProvider>
|
||||
|
@ -22,19 +22,19 @@ export default function Features() {
|
||||
|
||||
const images = {
|
||||
'item-1': {
|
||||
image: '/charts.png',
|
||||
image: '/images/blocks/charts.png',
|
||||
alt: 'Database visualization',
|
||||
},
|
||||
'item-2': {
|
||||
image: '/music.png',
|
||||
image: '/images/blocks/music.png',
|
||||
alt: 'Security authentication',
|
||||
},
|
||||
'item-3': {
|
||||
image: '/mail2.png',
|
||||
image: '/images/blocks/mail2.png',
|
||||
alt: 'Identity management',
|
||||
},
|
||||
'item-4': {
|
||||
image: '/payments.png',
|
||||
image: '/images/blocks/payments.png',
|
||||
alt: 'Analytics dashboard',
|
||||
},
|
||||
};
|
||||
|
@ -9,7 +9,6 @@ import { LocaleLink } from '@/i18n/navigation';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { useTranslations } from 'next-intl';
|
||||
import React from 'react';
|
||||
import LocaleSwitcher from './locale-switcher';
|
||||
import { ThemeSelector } from './theme-selector';
|
||||
|
||||
export function Footer({ className }: React.HTMLAttributes<HTMLElement>) {
|
||||
|
@ -44,6 +44,7 @@ import {
|
||||
UserPlusIcon
|
||||
} from 'lucide-react';
|
||||
import { useTranslations } from 'next-intl';
|
||||
import { XTwitterIcon } from './components/icons/x';
|
||||
|
||||
/**
|
||||
* website config, without translations
|
||||
@ -527,7 +528,7 @@ export function getSocialLinks(): MenuItem[] {
|
||||
socialLinks.push({
|
||||
title: 'Twitter',
|
||||
href: websiteConfig.social.twitter,
|
||||
icon: <TwitterIcon className="size-4 shrink-0" />,
|
||||
icon: <XTwitterIcon className="size-4 shrink-0" />,
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user