Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,11 @@ draft: false # true 时不发布
- 用 `##` / `###` 写小节标题,文章页会自动生成目录(至少 3 个小节时显示)。
- 没有设置 `ogImage` 的文章会自动生成分享预览图。

### 中英双语
### 文章语言

- 英文站在根路径 `/`,中文站在 `/zh/`,页面右上角可以切换语言。
- 给文章加英文版:在原文旁边放一个同名的 `.en.md` 文件,例如 `vim_usage.md` + `vim_usage.en.md`,两个版本共用同一个网址。
- 没有后缀的文章默认是中文;如果原文是英文,在 frontmatter 里加 `lang: en`。
- 某种语言没有对应版本时,会显示原文并提示读者。
- 「关于」页面同理:`src/content/pages/about.md`,可用 `about.en.md` / `about.zh.md` 覆盖。
- 博客默认使用中文,文章直接发布在根路径下,例如 `/posts/tools/vim_usage/`。
- 原有 `/zh/` 开头的链接会跳转到对应的根路径。
- 将来需要其他语言时,再完善翻译、语言入口及对应链接。

## 目录结构

Expand Down
4 changes: 2 additions & 2 deletions astro-paper.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ export default defineAstroPaperConfig({
site: {
url: "https://blog.weenas.com/",
title: "川流不息",
description: "Eason's notes on networking, tools, embedded development and life.",
description: "Eason 的技术笔记:网络、工具、嵌入式开发与生活记录。",
author: "Eason Xiang",
profile: "https://github.com/easonxiang",
ogImage: "default-og.jpg",
lang: "en",
lang: "zh",
googleVerification: "Y6VubbWBGYz9tLmVTOoR4rcjThETjxR7fxVf4U6udIQ",
bingVerification: "92DD827E38EA11E9EFB394F55CEACE8E",
timezone: "Asia/Shanghai",
Expand Down
11 changes: 1 addition & 10 deletions astro.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
} from "@shikijs/transformers";
import { transformerFileName } from "./src/utils/transformers/fileName";
import config from "./astro-paper.config";
import { DEFAULT_LOCALE, LOCALES, LOCALE_META } from "./src/i18n/locales";
import { DEFAULT_LOCALE, LOCALES } from "./src/i18n/locales";

export default defineConfig({
site: config.site.url,
Expand All @@ -42,20 +42,11 @@ export default defineConfig({
!/\/search\/$/.test(page) &&
(config.features?.showArchives !== false ||
!page.endsWith("/archives/")),
i18n: {
defaultLocale: DEFAULT_LOCALE,
locales: Object.fromEntries(
LOCALES.map(locale => [locale, LOCALE_META[locale].htmlLang])
),
},
}),
],
i18n: {
locales: [...LOCALES],
defaultLocale: DEFAULT_LOCALE,
// Every page is written once; `/zh/*` is rendered from the same route
// with `Astro.currentLocale === "zh"`.
fallback: { zh: DEFAULT_LOCALE },
routing: {
prefixDefaultLocale: false,
fallbackType: "rewrite",
Expand Down
9 changes: 7 additions & 2 deletions public/_redirects
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,10 @@
# linode_usage used to have `slug: 8db64a10`
/posts/net/8db64a10/ /posts/net/linode_usage/ 301
/posts/net/8db64a10 /posts/net/linode_usage/ 301
/zh/posts/net/8db64a10/ /zh/posts/net/linode_usage/ 301
/zh/posts/net/8db64a10 /zh/posts/net/linode_usage/ 301
/zh/posts/net/8db64a10/ /posts/net/linode_usage/ 301
/zh/posts/net/8db64a10 /posts/net/linode_usage/ 301

# Chinese pages now live at the root paths.
/zh / 301
/zh/ / 301
/zh/* /:splat 301
4 changes: 2 additions & 2 deletions src/content/pages/about.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: "About"
description: "A bit about me and this blog."
title: "关于"
description: "关于我和这个博客。"
---

35 changes: 0 additions & 35 deletions src/content/posts/cmake/cmake_history.en.md

This file was deleted.

30 changes: 0 additions & 30 deletions src/content/posts/life/2023_spring_flowers.en.md

This file was deleted.

Loading
Loading