Skip to content

Commit 3a36fd7

Browse files
committed
refactor(config): 重构多语言菜单配置并修复链接页面slug
- 将内联在 languages.toml 中的菜单配置提取到独立的 menu.en.toml 和 menu.zh-cn.toml 文件,提升模块化和可维护性 - 删除旧的 menu.toml 文件,统一使用按语言分隔的配置文件 - 为英文链接页面添加缺失的 slug 字段,确保路由正确 - 修复英文版 email 社交链接的 URL,将其指向正确的链接页面
1 parent 11fa7c6 commit 3a36fd7

5 files changed

Lines changed: 92 additions & 72 deletions

File tree

config/_default/languages.toml

Lines changed: 1 addition & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,6 @@ contentDir = "content/zh-cn"
77
weight = 1
88
[zh-cn.params.sidebar]
99
subtitle = "我的数字花园 🌱 - 基于 GitHub Pages 搭建的博客与文档。欢迎分享想法!"
10-
[zh-cn.menu]
11-
[[zh-cn.menu.main]]
12-
identifier = "home"
13-
name = "主页"
14-
url = "/"
15-
weight = 1
16-
[zh-cn.menu.main.params]
17-
icon = "home"
18-
[[zh-cn.menu.main]]
19-
identifier = "archives"
20-
name = "所有博客"
21-
url = "/archives/"
22-
weight = 2
23-
[zh-cn.menu.main.params]
24-
icon = "archives"
25-
[[zh-cn.menu.main]]
26-
identifier = "search"
27-
name = "搜索"
28-
url = "/search/"
29-
weight = 3
30-
[zh-cn.menu.main.params]
31-
icon = "search"
32-
[[zh-cn.menu.main]]
33-
identifier = "links"
34-
name = "链接"
35-
url = "/links/"
36-
weight = 4
37-
[zh-cn.menu.main.params]
38-
icon = "link"
3910

4011
[en]
4112
languageName = "English"
@@ -44,33 +15,4 @@ title = "Personal Blogs for Fernweh"
4415
contentDir = "content/en"
4516
weight = 2
4617
[en.params.sidebar]
47-
subtitle = "My digital garden 🌱 - A blog and docs built with GitHub Pages. Thoughts welcome!"
48-
[en.menu]
49-
[[en.menu.main]]
50-
identifier = "home"
51-
name = "Home"
52-
url = "/en/"
53-
weight = 1
54-
[en.menu.main.params]
55-
icon = "home"
56-
[[en.menu.main]]
57-
identifier = "archives"
58-
name = "Archives"
59-
url = "/en/archives/"
60-
weight = 2
61-
[en.menu.main.params]
62-
icon = "archives"
63-
[[en.menu.main]]
64-
identifier = "search"
65-
name = "Search"
66-
url = "/en/search/"
67-
weight = 3
68-
[en.menu.main.params]
69-
icon = "search"
70-
[[en.menu.main]]
71-
identifier = "links"
72-
name = "Links"
73-
url = "/en/links/"
74-
weight = 4
75-
[en.menu.main.params]
76-
icon = "link"
18+
subtitle = "My digital garden 🌱 - A blog and docs built with GitHub Pages. Thoughts welcome!"

config/_default/menu.en.toml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
[[main]]
2+
identifier = "home"
3+
name = "Home"
4+
url = "/en/"
5+
weight = 1
6+
[main.params]
7+
icon = "home"
8+
9+
[[main]]
10+
identifier = "archives"
11+
name = "Archives"
12+
url = "/en/archives/"
13+
weight = 2
14+
[main.params]
15+
icon = "archives"
16+
17+
[[main]]
18+
identifier = "search"
19+
name = "Search"
20+
url = "/en/search/"
21+
weight = 3
22+
[main.params]
23+
icon = "search"
24+
25+
[[main]]
26+
identifier = "links"
27+
name = "Links"
28+
url = "/en/links/"
29+
weight = 4
30+
[main.params]
31+
icon = "link"
32+
33+
[[social]]
34+
identifier = "github"
35+
name = "GitHub"
36+
url = "https://github.com/CodeGlimpse"
37+
[social.params]
38+
icon = "brand-github"
39+
40+
[[social]]
41+
identifier = "email"
42+
name = "Email"
43+
url = "/en/links/"
44+
[social.params]
45+
icon = "mail"

config/_default/menu.toml

Lines changed: 0 additions & 13 deletions
This file was deleted.

config/_default/menu.zh-cn.toml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
[[main]]
2+
identifier = "home"
3+
name = "主页"
4+
url = "/"
5+
weight = 1
6+
[main.params]
7+
icon = "home"
8+
9+
[[main]]
10+
identifier = "archives"
11+
name = "所有博客"
12+
url = "/archives/"
13+
weight = 2
14+
[main.params]
15+
icon = "archives"
16+
17+
[[main]]
18+
identifier = "search"
19+
name = "搜索"
20+
url = "/search/"
21+
weight = 3
22+
[main.params]
23+
icon = "search"
24+
25+
[[main]]
26+
identifier = "links"
27+
name = "链接"
28+
url = "/links/"
29+
weight = 4
30+
[main.params]
31+
icon = "link"
32+
33+
[[social]]
34+
identifier = "github"
35+
name = "GitHub"
36+
url = "https://github.com/CodeGlimpse"
37+
[social.params]
38+
icon = "brand-github"
39+
40+
[[social]]
41+
identifier = "email"
42+
name = "Email"
43+
url = "mailto:libochen@codeglimpse.top"
44+
[social.params]
45+
icon = "mail"

content/en/page/links/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: Contacts
3+
slug: "links"
34
links:
45
- title: GitHub
56
description: GitHub is the world's largest software development platform.

0 commit comments

Comments
 (0)