From f13f04832560e9f9d6dc8541fc73fb9cb5ba908d Mon Sep 17 00:00:00 2001 From: fukunee Date: Wed, 13 May 2026 16:11:10 +0800 Subject: [PATCH] Add Chinese i18n and SEO settings, customize home layout --- hugo.yaml | 52 ++++++++++++++++++++++++++++++++++++- i18n/zh-cn.yaml | 3 +++ layouts/hextra-home.html | 55 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 i18n/zh-cn.yaml create mode 100644 layouts/hextra-home.html diff --git a/hugo.yaml b/hugo.yaml index ca3591c..f24beb5 100644 --- a/hugo.yaml +++ b/hugo.yaml @@ -51,26 +51,45 @@ menu: type: search params: + # SEO description: 一只爪子的技术笔记与生活记录 + images: + - /images/logo.svg + # Favicon 路径 + favicon: + dark: /images/logo-dark.svg + light: /images/logo.svg + + # 导航栏 navbar: displayTitle: true displayLogo: false width: wide + # logo: + # path: /images/logo.svg + # dark: /images/logo-dark.svg + # link: / + # width: 32 + # height: 32 + # 主题 theme: default: system displayToggle: true + # 页脚 footer: enable: true displayCopyright: true displayPoweredBy: false width: normal + # 日期 displayUpdatedDate: false dateFormat: "2006-01-02" + # 搜索 search: enable: true type: flexsearch @@ -78,20 +97,51 @@ params: index: content tokenize: forward + # 博客 blog: list: displayTags: true sortBy: date sortOrder: desc - pagerSize: 20 + pagerSize: 10 + displayDate: true + displaySummary: true article: displayPagination: true + displayReadMore: true + # 目录 toc: displayTags: true + # 页面 page: width: normal + # 评论 (关闭) comments: enable: false + # type: giscus + # giscus: + # repo: your/repo + # repoId: xxx + # category: General + # categoryId: xxx + + # RSS 定制 + rss: + limit: 20 + + # 代码高亮增强 + highlight: + copy: + enable: true + lineNumbers: false + + # Open Graph / SEO 增强 + opengraph: + enable: true + + # Schema.org 结构化数据 + schema: + enable: true diff --git a/i18n/zh-cn.yaml b/i18n/zh-cn.yaml new file mode 100644 index 0000000..3caf4bd --- /dev/null +++ b/i18n/zh-cn.yaml @@ -0,0 +1,3 @@ +# 覆盖 Hextra 主题默认文案 +copyright: "© 2026 爪子笔记" +poweredBy: "" diff --git a/layouts/hextra-home.html b/layouts/hextra-home.html new file mode 100644 index 0000000..3a7e374 --- /dev/null +++ b/layouts/hextra-home.html @@ -0,0 +1,55 @@ +{{ define "main" }} +
+ {{ partial "sidebar.html" (dict "context" . "disableSidebar" true) }} +
+
{{ .Content }}
+ + {{- $pages := where .Site.RegularPages "Section" "blog" }} {{- $pages = + $pages.ByDate.Reverse }} {{- $recent := first 6 $pages }} {{- $readMore + := (T "readMore") | default "Read more →" }} + +
+

+ 📝 最新文章 +

+ {{- range $recent }} +
+

+ {{ .Title }} +

+ {{- if site.Params.blog.list.displayTags }} +
+ {{ partial "tags.html" (dict "context" .) }} +
+ {{- end }} +

+ {{- partial "utils/page-description" . -}} +

+

+ {{ partial "utils/format-date" .Date }} +

+
+ {{- end }} {{- if gt (len $pages) 6 }} +

+ + {{ $readMore }} + +

+ {{- end }} +
+
+
+{{ end }}