diff --git a/astro.config.ts b/astro.config.ts
index 551fa7e..b003d41 100644
--- a/astro.config.ts
+++ b/astro.config.ts
@@ -28,13 +28,22 @@ import { GithubCardComponent } from './src/plugins/rehype-component-github-card.
import { parseDirectiveNode } from './src/plugins/remark-directive-rehype.js'
import { remarkExcerpt } from './src/plugins/remark-excerpt.js'
import { remarkReadingTime } from './src/plugins/remark-reading-time.mjs'
+import { langMap } from './src/utils/ui'
const { url }: { url: ThemeConfig['site']['url'] } = themeConfig.site
+const { locale }: { locale: ThemeConfig['global']['locale'] } = themeConfig.global
export default defineConfig({
site: url,
base: '/',
trailingSlash: 'always',
+ i18n: {
+ locales: Object.entries(langMap).map(([path, codes]) => ({
+ path,
+ codes,
+ })),
+ defaultLocale: locale,
+ },
integrations: [
partytown({
config: {
diff --git a/public/image/astro-icon.svg b/public/image/astro-icon.svg
new file mode 100644
index 0000000..52b76d5
--- /dev/null
+++ b/public/image/astro-icon.svg
@@ -0,0 +1,11 @@
+
diff --git a/src/components/Head.astro b/src/components/Head.astro
index 0388109..800d25c 100644
--- a/src/components/Head.astro
+++ b/src/components/Head.astro
@@ -10,7 +10,7 @@ interface Props {
const { postTitle, postDescription, postImage } = Astro.props
const { title, subtitle, description, author, url, favicon } = themeConfig.site
const { light: { backgroundStart: lightMode }, dark: { backgroundStart: darkMode } } = themeConfig.color
-const { language } = themeConfig.global
+const { locale, moreLocale } = themeConfig.global
const { verification = {}, twitterID = '', facebookID = '', facebookLink = '', googleAnalyticsID = '', umamiAnalyticsID = '', siteScreenshot = '' } = themeConfig.seo ?? {}
const { google = '', bing = '', yandex = '', baidu = '' } = verification
const { cdn, commentURL = '', imageHostURL = '', customGoogleAnalyticsURL = '', customUmamiAnalyticsURL = '', customUmamiAnalyticsJS = '' } = themeConfig.preload
@@ -46,11 +46,18 @@ const { cdn, commentURL = '', imageHostURL = '', customGoogleAnalyticsURL = '',
-
-
+
+{[locale, ...moreLocale].map(lang => (
+
+))}
+
@@ -60,7 +67,7 @@ const { cdn, commentURL = '', imageHostURL = '', customGoogleAnalyticsURL = '',
-
+
diff --git a/src/config/index.ts b/src/config/index.ts
index 2a87bee..866e929 100644
--- a/src/config/index.ts
+++ b/src/config/index.ts
@@ -30,7 +30,8 @@ export const themeConfig: ThemeConfig = {
// GLOBAL SETTINGS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> START
global: {
- language: 'zh-CN', // en-US, zh-CN
+ locale: 'zh', // zh, zh-tw, ja, en, es, ru, default locale setting
+ moreLocale: ['zh-tw', 'ja', 'en', 'es', 'ru'], // ['zh-tw', 'ja', 'en', 'es', 'ru'], not fill in the default locale code again
font: 'sans', // sans, serif, choose the font style for posts
rss: true, // true, false, whether to enable RSS
toc: true, // true, false, whether to enable table of contents in posts
diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro
index e0c51fd..4986ecd 100644
--- a/src/layouts/Layout.astro
+++ b/src/layouts/Layout.astro
@@ -2,7 +2,7 @@
import Head from '@/components/Head.astro'
---
-
+