Skip to content

Commit

Permalink
Merge pull request #69 from heavenmei/main
Browse files Browse the repository at this point in the history
中文seo
  • Loading branch information
yangchuansheng authored Oct 23, 2024
2 parents 65df45e + cafde8a commit 8de7138
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 3 deletions.
9 changes: 9 additions & 0 deletions projects/fastgpt/app/[[...lang]]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import Feature from '@/components/home/Feature';
import Hero from '@/components/home/Hero';
// import SocialProof from '@/components/home/SocialProof';
import VideoPlayer from '@/components/home/Video';
import { siteConfig, siteConfigZh } from '@/config/site';
import { defaultLocale, getDictionary, localeNames } from '@/lib/i18n';
import { SiteConfig } from '@/types/siteConfig';

export default async function LangHome({ params: { lang } }: { params: { lang?: string[] } }) {
let langName = lang && lang[0] && lang[0] !== 'index' ? lang[0] : defaultLocale;
Expand Down Expand Up @@ -58,3 +60,10 @@ export async function generateStaticParams() {
const keys = Object.keys(localeNames).map((lang) => ({ lang: [lang] }));
return [{ lang: [''] }, ...keys];
}

export async function generateMetadata(
{ params: { lang } }: { params: { lang?: string[] } }
): Promise<SiteConfig> {
let langName = lang && lang[0] && lang[0] !== 'index' ? lang[0] : defaultLocale;
return langName === 'zh' ? siteConfigZh : siteConfig;
}
7 changes: 5 additions & 2 deletions projects/fastgpt/components/header/LangSwitcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ export const LangSwitcher = () => {

const handleSwitchLanguage = (value: string) => {
localStorage.setItem('preferredLang', value);
if (value === defaultLocale) {
if (value === 'zh') {
router.push('https://fastgpt.cn/');
return;
}else if (value === defaultLocale) {
router.push('/');
return;
}
Expand All @@ -29,7 +32,7 @@ export const LangSwitcher = () => {

useEffect(() => {
const storedLang = localStorage.getItem('preferredLang');
if (storedLang && storedLang !== lang) {
if (storedLang && storedLang !== lang && storedLang !== defaultLocale) {
router.push(storedLang);
}
}, []);
Expand Down
2 changes: 1 addition & 1 deletion projects/fastgpt/components/home/Hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const Hero = ({ locale, CTALocale, stars }: { locale: any; CTALocale: any; stars
border: '1px solid rgba(179, 220, 229, 0.40)',
}}
>
<span style={{ color: '#F8A3FF' }}>9w+&nbsp;</span>
<span style={{ color: '#F8A3FF' }}>20w+&nbsp;</span>
{locale.maker}
</div>

Expand Down
25 changes: 25 additions & 0 deletions projects/fastgpt/config/site.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { MdEmail } from 'react-icons/md';
const OPEN_SOURCE_URL = 'https://github.com/labring/FastGPT';

const baseSiteConfig = {
title: 'FastGPT',
name: 'FastGPT',
description:
'A free, open-source, and powerful AI knowledge base platform, offers out-of-the-box data processing, model invocation, RAG retrieval, and visual AI workflows. Easily build complex Q&A systems.',
Expand Down Expand Up @@ -98,3 +99,27 @@ export const siteConfig: SiteConfig = {
creator: baseSiteConfig.creator
}
};

export const siteConfigZh: SiteConfig = {
...siteConfig,
title: 'FastGPT - 企业级智能AI模型问答知识库',
description:'FastGPT是一个基于 LLM 大语言模型的知识库问答系统,提供开箱即用的数据处理、模型调用等能力.同时可以通过 Flow 可视化进行工作流编排,从而实现复杂的问答场景!',
keywords: [
'FastGPT',
'free',
'知识库',
'问答',
'数据处理',
'模型调用',
'RAG检索',
'可视化AI工作流',
'企业知识库',
'rag',
'ai',
'workflow',
'llm',
'gpt',
'gpt4',
'orchestration',
],
};
1 change: 1 addition & 0 deletions projects/fastgpt/types/siteConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export type ThemeColor = {
color: string;
};
export type SiteConfig = {
title: string;
name: string;
description: string;
url: string;
Expand Down

0 comments on commit 8de7138

Please sign in to comment.