├── assets
├── css
│ ├── custom.css
│ ├── main.css
│ ├── toc.css
│ └── gallery.css
├── images
│ ├── 01.avif
│ ├── 02.avif
│ ├── 03.avif
│ ├── 04.avif
│ ├── 05.avif
│ ├── 06.avif
│ ├── 07.avif
│ └── 08.avif
└── icons
│ ├── check.svg
│ ├── arrow-right.svg
│ ├── chevron-down.svg
│ ├── chevron-left.svg
│ ├── chevron-right.svg
│ ├── text.svg
│ ├── code.svg
│ ├── clock.svg
│ ├── alert-circle.svg
│ ├── info-circle.svg
│ ├── user.svg
│ ├── folder.svg
│ ├── calendar.svg
│ ├── chevron-up.svg
│ ├── close.svg
│ ├── menu.svg
│ ├── copy.svg
│ ├── edit.svg
│ ├── file-text.svg
│ ├── search.svg
│ ├── related.svg
│ ├── about.svg
│ ├── alert-triangle.svg
│ ├── rss.svg
│ ├── arrow-up.svg
│ ├── exclamation-triangle.svg
│ ├── message.svg
│ ├── archive.svg
│ ├── moon.svg
│ ├── message-circle.svg
│ ├── contact.svg
│ ├── email.svg
│ ├── arrow-left.svg
│ ├── monitor.svg
│ ├── chart.svg
│ ├── language.svg
│ ├── license.svg
│ ├── external-link.svg
│ ├── heart.svg
│ ├── tags.svg
│ ├── palette.svg
│ ├── lightbulb.svg
│ ├── posts.svg
│ ├── home.svg
│ ├── sun.svg
│ ├── categories.svg
│ ├── linkedin.svg
│ ├── link.svg
│ ├── twitter.svg
│ ├── layers.svg
│ ├── blog.svg
│ ├── youtube.svg
│ ├── tag.svg
│ ├── list.svg
│ ├── github.svg
│ ├── telegram.svg
│ ├── mastodon.svg
│ └── wechat.svg
├── go.mod
├── images
├── tn.png
├── home.png
├── screenshot.png
└── screenshot-dark.png
├── static
├── fonts
│ ├── lg.ttf
│ ├── lg.woff
│ └── lg.woff2
├── images
│ ├── og-default.avif
│ ├── placeholder
│ │ ├── 1.jpg
│ │ ├── 2.jpg
│ │ ├── 3.jpg
│ │ ├── 4.jpg
│ │ ├── 5.jpg
│ │ ├── 6.jpg
│ │ ├── 7.jpg
│ │ └── 8.jpg
│ ├── logo.svg
│ └── avatar.svg
├── css
│ └── fjGallery.css
├── favicon.svg
└── js
│ └── gumshoe.polyfills.min.js
├── exampleSite
└── content
│ ├── archives
│ ├── _index.fr.md
│ ├── _index.ja.md
│ ├── _index.md
│ └── _index.zh-cn.md
│ ├── posts
│ ├── render-image
│ │ ├── bundle.avif
│ │ ├── index.zh-cn.md
│ │ ├── index.ja.md
│ │ ├── index.md
│ │ └── index.fr.md
│ ├── katex-mermaid-test.md
│ ├── alert-test.zh-cn.md
│ ├── alert-test.ja.md
│ ├── alert-test.md
│ ├── code-highlighting-test.zh-cn.md
│ ├── katex-mermaid-test.zh-cn.md
│ ├── markdown-test.zh-cn.md
│ ├── code-highlighting-test.ja.md
│ ├── katex-mermaid-test.ja.md
│ ├── code-highlighting-test.md
│ └── markdown-test.ja.md
│ ├── _index.zh-cn.md
│ ├── _index.ja.md
│ ├── _index.md
│ ├── _index.fr.md
│ ├── about.zh-cn.md
│ ├── about.ja.md
│ ├── about.md
│ └── about.fr.md
├── layouts
├── _partials
│ ├── features
│ │ ├── analytics
│ │ │ ├── umami.html
│ │ │ ├── baidu.html
│ │ │ ├── clarity.html
│ │ │ └── google.html
│ │ ├── analytics.html
│ │ ├── comments
│ │ │ ├── waline.html
│ │ │ ├── twikoo.html
│ │ │ ├── utterances.html
│ │ │ ├── artalk.html
│ │ │ └── disqus.html
│ │ ├── icon.html
│ │ ├── comments.html
│ │ ├── mermaid.html
│ │ └── katex.html
│ ├── layout
│ │ ├── head
│ │ │ ├── seo.html
│ │ │ └── css.html
│ │ ├── head.html
│ │ └── footer.html
│ ├── content
│ │ ├── custom_1.html
│ │ ├── terms.html
│ │ ├── custom_2.html
│ │ ├── related-posts.html
│ │ ├── post-list.html
│ │ ├── image-processor.html
│ │ ├── link.html
│ │ └── post-license.html
│ ├── ui
│ │ ├── theme-switcher.html
│ │ ├── dark-mode-switcher.html
│ │ ├── dropdown-button.html
│ │ ├── toc-card.html
│ │ ├── language-switcher.html
│ │ └── reading-progress.html
│ ├── config
│ │ └── gallery.html
│ └── navigation
│ │ ├── mobile-menu-toggle.html
│ │ └── header.html
├── _markup
│ ├── render-codeblock-mermaid.html
│ ├── render-link.html
│ └── render-image.html
├── _shortcodes
│ ├── tencent.html
│ ├── bilibili.html
│ └── link.html
├── single.html
├── index.webappmanifest
├── index.json
├── about.html
├── 404.html
├── baseof.html
├── posts
│ ├── single.html
│ └── list.html
├── list.html
├── term.html
└── home.html
├── vercel.json
├── archetypes
└── default.md
├── .gitignore
├── data
├── placeholder_images.yaml
└── links.yaml
├── LICENSE
├── theme.toml
├── README.md
└── i18n
├── zh-tw.yaml
└── ar.yaml
/assets/css/custom.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/go.mod:
--------------------------------------------------------------------------------
1 | module github.com/tom2almighty/hugo-narrow
2 |
3 | go 1.21
4 |
--------------------------------------------------------------------------------
/images/tn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tom2almighty/hugo-narrow/HEAD/images/tn.png
--------------------------------------------------------------------------------
/images/home.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tom2almighty/hugo-narrow/HEAD/images/home.png
--------------------------------------------------------------------------------
/static/fonts/lg.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tom2almighty/hugo-narrow/HEAD/static/fonts/lg.ttf
--------------------------------------------------------------------------------
/assets/images/01.avif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tom2almighty/hugo-narrow/HEAD/assets/images/01.avif
--------------------------------------------------------------------------------
/assets/images/02.avif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tom2almighty/hugo-narrow/HEAD/assets/images/02.avif
--------------------------------------------------------------------------------
/assets/images/03.avif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tom2almighty/hugo-narrow/HEAD/assets/images/03.avif
--------------------------------------------------------------------------------
/assets/images/04.avif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tom2almighty/hugo-narrow/HEAD/assets/images/04.avif
--------------------------------------------------------------------------------
/assets/images/05.avif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tom2almighty/hugo-narrow/HEAD/assets/images/05.avif
--------------------------------------------------------------------------------
/assets/images/06.avif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tom2almighty/hugo-narrow/HEAD/assets/images/06.avif
--------------------------------------------------------------------------------
/assets/images/07.avif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tom2almighty/hugo-narrow/HEAD/assets/images/07.avif
--------------------------------------------------------------------------------
/assets/images/08.avif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tom2almighty/hugo-narrow/HEAD/assets/images/08.avif
--------------------------------------------------------------------------------
/images/screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tom2almighty/hugo-narrow/HEAD/images/screenshot.png
--------------------------------------------------------------------------------
/static/fonts/lg.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tom2almighty/hugo-narrow/HEAD/static/fonts/lg.woff
--------------------------------------------------------------------------------
/static/fonts/lg.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tom2almighty/hugo-narrow/HEAD/static/fonts/lg.woff2
--------------------------------------------------------------------------------
/images/screenshot-dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tom2almighty/hugo-narrow/HEAD/images/screenshot-dark.png
--------------------------------------------------------------------------------
/assets/icons/check.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/static/images/og-default.avif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tom2almighty/hugo-narrow/HEAD/static/images/og-default.avif
--------------------------------------------------------------------------------
/assets/icons/arrow-right.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/exampleSite/content/archives/_index.fr.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Archives"
3 | description: ""
4 | layout: "archives"
5 | ---
6 |
--------------------------------------------------------------------------------
/exampleSite/content/archives/_index.ja.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "アーカイブ"
3 | description: ""
4 | layout: "archives"
5 | ---
6 |
--------------------------------------------------------------------------------
/exampleSite/content/archives/_index.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Archives"
3 | description: ""
4 | layout: "archives"
5 | ---
6 |
--------------------------------------------------------------------------------
/exampleSite/content/archives/_index.zh-cn.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "归档"
3 | description: ""
4 | layout: "archives"
5 | ---
6 |
--------------------------------------------------------------------------------
/static/images/placeholder/1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tom2almighty/hugo-narrow/HEAD/static/images/placeholder/1.jpg
--------------------------------------------------------------------------------
/static/images/placeholder/2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tom2almighty/hugo-narrow/HEAD/static/images/placeholder/2.jpg
--------------------------------------------------------------------------------
/static/images/placeholder/3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tom2almighty/hugo-narrow/HEAD/static/images/placeholder/3.jpg
--------------------------------------------------------------------------------
/static/images/placeholder/4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tom2almighty/hugo-narrow/HEAD/static/images/placeholder/4.jpg
--------------------------------------------------------------------------------
/static/images/placeholder/5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tom2almighty/hugo-narrow/HEAD/static/images/placeholder/5.jpg
--------------------------------------------------------------------------------
/static/images/placeholder/6.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tom2almighty/hugo-narrow/HEAD/static/images/placeholder/6.jpg
--------------------------------------------------------------------------------
/static/images/placeholder/7.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tom2almighty/hugo-narrow/HEAD/static/images/placeholder/7.jpg
--------------------------------------------------------------------------------
/static/images/placeholder/8.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tom2almighty/hugo-narrow/HEAD/static/images/placeholder/8.jpg
--------------------------------------------------------------------------------
/assets/icons/chevron-down.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/assets/icons/chevron-left.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/assets/icons/chevron-right.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/assets/icons/text.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/assets/icons/code.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/assets/icons/clock.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/assets/icons/alert-circle.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/exampleSite/content/posts/render-image/bundle.avif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tom2almighty/hugo-narrow/HEAD/exampleSite/content/posts/render-image/bundle.avif
--------------------------------------------------------------------------------
/assets/icons/info-circle.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/assets/icons/user.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/assets/icons/folder.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/assets/icons/calendar.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/assets/icons/chevron-up.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/assets/icons/close.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/assets/icons/menu.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/assets/icons/copy.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/assets/icons/edit.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/assets/icons/file-text.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/assets/icons/search.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/assets/icons/related.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/assets/icons/about.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/assets/icons/alert-triangle.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/assets/icons/rss.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/assets/icons/arrow-up.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/assets/icons/exclamation-triangle.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/layouts/_partials/features/analytics/umami.html:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/assets/icons/message.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/assets/icons/archive.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/assets/icons/moon.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/assets/icons/message-circle.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/assets/icons/contact.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/assets/icons/email.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/layouts/_partials/features/analytics/baidu.html:
--------------------------------------------------------------------------------
1 |
4 |
8 |
--------------------------------------------------------------------------------
/vercel.json:
--------------------------------------------------------------------------------
1 | {
2 | "build": {
3 | "env": {
4 | "HUGO_VERSION": "0.146.0"
5 | }
6 | },
7 | "buildCommand": "cp exampleSite/hugo.yaml . && cp -r exampleSite/content . && grep -v '^theme:' hugo.yaml > temp.yaml && mv temp.yaml hugo.yaml && hugo --minify --gc"
8 | }
--------------------------------------------------------------------------------
/assets/icons/arrow-left.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/assets/icons/monitor.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/archetypes/default.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: '{{ replace .File.ContentBaseName "-" " " | title }}'
3 | date: {{ .Date }}
4 | draft: false
5 | slug: {{ substr .File.UniqueID 0 7 }}
6 | description:
7 | summary:
8 | tags:
9 | - draft
10 | categories:
11 | - draft
12 | cover:
13 | ---
14 |
--------------------------------------------------------------------------------
/assets/icons/chart.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/assets/icons/language.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/assets/icons/license.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/assets/icons/external-link.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/assets/icons/heart.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/assets/icons/tags.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/assets/icons/palette.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/assets/icons/lightbulb.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/assets/icons/posts.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/assets/icons/home.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/assets/icons/sun.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/assets/icons/categories.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/assets/icons/linkedin.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | Thumbs.db
2 | .DS_Store
3 | .dist
4 | .tmp
5 | .lock
6 | .sass-cache
7 | npm-debug.log
8 | node_modules
9 | builds
10 | package-lock.json
11 | package.json
12 | pnpm-lock.yaml
13 | public
14 | resources
15 | .hugo_build.lock
16 | jsconfig.json
17 | hugo_stats.json
18 | go.sum
19 | yarn.lock
20 | .prettierrc
21 | .prettierignore
22 |
--------------------------------------------------------------------------------
/assets/icons/link.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/assets/icons/twitter.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/assets/icons/layers.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/static/images/logo.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/layouts/_partials/layout/head/seo.html:
--------------------------------------------------------------------------------
1 | {{ partial "opengraph.html" . }}
2 | {{ partial "twitter_cards.html" . }}
3 | {{ partial "schema.html" . }}
4 |
5 | {{/* RSS Feed */}}
6 | {{ with .OutputFormats.Get "rss" }}
7 |
12 | {{ end }}
13 |
--------------------------------------------------------------------------------
/assets/css/main.css:
--------------------------------------------------------------------------------
1 | /* Hugo Narrow 主题 - 主样式文件 */
2 | @import "tailwindcss";
3 |
4 | @custom-variant dark (&:where(.dark, .dark *));
5 |
6 |
7 | @layer theme {
8 | @import "./themes.css";
9 | }
10 |
11 | @layer base {
12 | @import "./base.css";
13 | }
14 |
15 | @layer components {
16 | @import "./components.css";
17 | }
18 |
19 | @layer utilities {
20 | @import "./custom.css";
21 | }
--------------------------------------------------------------------------------
/static/css/fjGallery.css:
--------------------------------------------------------------------------------
1 | .fj-gallery {
2 | position: relative;
3 | overflow: hidden;
4 | }
5 | .fj-gallery::after {
6 | content: "";
7 | display: block;
8 | clear: both;
9 | }
10 | .fj-gallery .fj-gallery-item {
11 | float: left;
12 | top: 0;
13 | left: 0;
14 | }
15 | .fj-gallery .fj-gallery-item > img {
16 | display: block;
17 | width: 100%;
18 | height: auto;
19 | }
20 |
--------------------------------------------------------------------------------
/static/favicon.svg:
--------------------------------------------------------------------------------
1 |
7 |
--------------------------------------------------------------------------------
/assets/icons/blog.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/layouts/_markup/render-codeblock-mermaid.html:
--------------------------------------------------------------------------------
1 | {{/* Mermaid diagram render hook
2 |
3 | Based on Hugo official documentation:
4 | https://gohugo.io/content-management/diagrams/#mermaid-diagrams
5 |
6 | Simple Mermaid rendering without extra UI elements
7 | */}}
8 |
9 |
10 |
11 | {{ .Inner | htmlEscape | safeHTML }}
12 |
13 | {{ .Page.Store.Set "hasMermaid" true }}
14 |
--------------------------------------------------------------------------------
/layouts/_partials/features/analytics/clarity.html:
--------------------------------------------------------------------------------
1 |
8 |
--------------------------------------------------------------------------------
/layouts/_partials/features/analytics/google.html:
--------------------------------------------------------------------------------
1 |
2 |
13 |
--------------------------------------------------------------------------------
/assets/icons/youtube.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/assets/icons/tag.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/assets/icons/list.svg:
--------------------------------------------------------------------------------
1 |
9 |
--------------------------------------------------------------------------------
/assets/icons/github.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/exampleSite/content/_index.zh-cn.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "首页"
3 | author:
4 | name: "Hugo Narrow"
5 | title: "简洁的 Hugo 主题"
6 | description: "专注于内容和用户体验。"
7 | avatar: "/images/avatar.svg"
8 | social:
9 | - name: "GitHub"
10 | url: "https://github.com/tom2almighty/hugo-narrow"
11 | icon: "github"
12 | - name: "Twitter"
13 | url: "https://twitter.com/username"
14 | icon: "twitter"
15 | - name: "邮箱"
16 | url: "mailto:hello@example.com"
17 | icon: "email"
18 | ---
--------------------------------------------------------------------------------
/exampleSite/content/_index.ja.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "ホーム"
3 | author:
4 | name: "Hugo Narrow"
5 | title: "クリーンでミニマルな Hugo テーマ"
6 | description: "コンテンツとユーザーエクスペリエンスに焦点を当てています。"
7 | avatar: "/images/avatar.svg"
8 | social:
9 | - name: "GitHub"
10 | url: "https://github.com/tom2almighty/hugo-narrow"
11 | icon: "github"
12 | - name: "Twitter"
13 | url: "https://twitter.com/username"
14 | icon: "twitter"
15 | - name: "メール"
16 | url: "mailto:hello@example.com"
17 | icon: "email"
18 | ---
--------------------------------------------------------------------------------
/exampleSite/content/_index.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Home"
3 | author:
4 | name: "Hugo Narrow"
5 | title: "A Clean and Minimal Hugo Theme"
6 | description: "Focused on content and user experience."
7 | avatar: "/images/avatar.svg"
8 | social:
9 | - name: "GitHub"
10 | url: "https://github.com/tom2almighty/hugo-narrow"
11 | icon: "github"
12 | - name: "Twitter"
13 | url: "https://twitter.com/username"
14 | icon: "twitter"
15 | - name: "Email"
16 | url: "mailto:hello@example.com"
17 | icon: "email"
18 | ---
--------------------------------------------------------------------------------
/exampleSite/content/_index.fr.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Accueil"
3 | author:
4 | name: "Hugo Narrow"
5 | title: "Un thème Hugo épuré et minimaliste"
6 | description: "Axé sur le contenu et l'expérience utilisateur."
7 | avatar: "/images/avatar.svg"
8 | social:
9 | - name: "GitHub"
10 | url: "https://github.com/tom2almighty/hugo-narrow"
11 | icon: "github"
12 | - name: "Twitter"
13 | url: "https://twitter.com/username"
14 | icon: "twitter"
15 | - name: "E-mail"
16 | url: "mailto:hello@example.com"
17 | icon: "email"
18 | ---
--------------------------------------------------------------------------------
/layouts/_shortcodes/tencent.html:
--------------------------------------------------------------------------------
1 |
2 | {{ $vid := .Get 0 }}
3 |
--------------------------------------------------------------------------------
/layouts/_partials/features/analytics.html:
--------------------------------------------------------------------------------
1 | {{ if .Site.Params.analytics.enabled -}}
2 | {{ if .Site.Params.analytics.baidu.enabled -}}
3 | {{ partial "features/analytics/baidu.html" . }}
4 | {{- end }}
5 |
6 | {{ if .Site.Params.analytics.clarity.enabled -}}
7 | {{ partial "features/analytics/clarity.html" . }}
8 | {{- end }}
9 |
10 | {{ if .Site.Params.analytics.google.enabled -}}
11 | {{ partial "features/analytics/google.html" . }}
12 | {{- end }}
13 |
14 | {{ if .Site.Params.analytics.umami.enabled -}}
15 | {{ partial "features/analytics/umami.html" . }}
16 | {{- end }}
17 | {{- end }}
18 |
--------------------------------------------------------------------------------
/layouts/single.html:
--------------------------------------------------------------------------------
1 | {{ define "main" }}
2 |
3 | {{ partial "navigation/breadcrumb.html" . }}
4 |
5 |
6 |
7 |
17 |
18 |
19 |
20 | {{ .Content }}
21 |
22 | {{ partial "features/comments.html" . }}
23 | {{ end }}
24 |
--------------------------------------------------------------------------------
/static/images/avatar.svg:
--------------------------------------------------------------------------------
1 |
17 |
--------------------------------------------------------------------------------
/assets/icons/telegram.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/layouts/_partials/content/custom_1.html:
--------------------------------------------------------------------------------
1 | {{/*
2 | 自定义内容示例 2 - 公告栏
3 | 文件位置: layouts/_partials/content/custom_2.html
4 | */}}
5 |
6 |
7 |
8 |
9 | 📢
10 |
11 |
12 |
网站公告
13 |
14 | 欢迎访问我的个人网站!这是一个自定义内容区域的示例。
15 | 你可以在这里放置任何你想要展示的内容。
16 |
17 |
18 | {{ now.Format "2006-01-02" }}
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/layouts/_markup/render-link.html:
--------------------------------------------------------------------------------
1 | {{- $isExternal := or (strings.HasPrefix .Destination "http://") (strings.HasPrefix .Destination "https://") -}}
2 | {{- if $isExternal -}}
3 |
8 | {{- with .Text | safeHTML }}{{ . }}{{ end -}}
9 | {{ partial "features/icon.html" (dict "name" "external-link" "class" "h-3 w-3 flex-shrink-0" "id" "external-link" "style" "color: #9ca3af; stroke: #9ca3af;") }}
10 |
11 | {{- else -}}
12 |
15 | {{- with .Text | safeHTML }}{{ . }}{{ end -}}
16 |
17 | {{- end -}}
--------------------------------------------------------------------------------
/data/placeholder_images.yaml:
--------------------------------------------------------------------------------
1 | # 随机占位图配置文件
2 |
3 | # 功能启用开关
4 | enabled: false
5 |
6 | # 图片URL列表(支持外部URL和本地路径)
7 | images:
8 | # Picsum Photos
9 | #- "https://picsum.photos/800/600?random=1"
10 | #- "https://picsum.photos/800/600?random=2"
11 | #- "https://picsum.photos/800/600?random=3"
12 | #- "https://picsum.photos/800/600?random=4"
13 | #- "https://picsum.photos/800/600?random=5"
14 | #- "https://picsum.photos/800/600?random=6&blur=1"
15 | #- "https://picsum.photos/800/600?random=7&grayscale"
16 | # local images
17 | - "/images/placeholder/1.jpg"
18 | - "/images/placeholder/2.jpg"
19 | - "/images/placeholder/3.jpg"
20 | - "/images/placeholder/4.jpg"
21 | - "/images/placeholder/5.jpg"
22 | - "/images/placeholder/6.jpg"
23 | - "/images/placeholder/7.jpg"
24 | - "/images/placeholder/8.jpg"
--------------------------------------------------------------------------------
/exampleSite/content/about.zh-cn.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "关于"
3 | layout: "about"
4 | summary: "了解 Hugo Narrow 主题及其技术栈"
5 | date: 2024-01-01T00:00:00+08:00
6 | links:
7 | - name: "Hugo 文档"
8 | url: "https://gohugo.io/"
9 | icon: "https://gohugo.io/favicon.ico"
10 | description: "世界上最快的静态网站生成器"
11 |
12 | - name: "Tailwind CSS"
13 | url: "https://tailwindcss.com/"
14 | icon: "https://tailwindcss.com/favicon.ico"
15 | description: "实用优先的 CSS 框架"
16 |
17 | - name: "GitHub"
18 | url: "https://github.com/"
19 | icon: "https://github.com/fluidicon.png"
20 | description: "全球最大的代码托管平台"
21 | ---
22 |
23 | ## 关于
24 |
25 | Hugo Narrow 是一个现代、简洁、极简的 Hugo 主题,基于 Tailwind CSS 4.0 构建。用于个人博客,具有丰富的自定义选项,包括多种配色方案、暗色模式支持和响应式设计。
26 |
27 | ## 技术栈
28 |
29 | - Hugo Extended
30 | - Tailwind CSS 4.0
31 | - @tailwindcss/typography
32 | - Glightbox
33 | - fjGallery
34 | - Macy.js
35 | - gumshoe
36 | - ...
37 |
38 |
--------------------------------------------------------------------------------
/layouts/_partials/content/terms.html:
--------------------------------------------------------------------------------
1 | {{- /*
2 | For a given taxonomy, renders a list of terms assigned to the page.
3 |
4 | @context {page} page The current page.
5 | @context {string} taxonomy The taxonomy.
6 |
7 | @example: {{ partial "terms.html" (dict "taxonomy" "tags" "page" .)
8 | }}
9 | */}}
10 | {{- $page := .page }}
11 | {{- $taxonomy := .taxonomy }}
12 |
13 | {{- with $page.GetTerms $taxonomy }}
14 | {{- $label := (index . 0).Parent.LinkTitle }}
15 |
16 |
17 | {{ if eq $taxonomy "tags" }}
18 | {{ i18n "post.tags" }}
19 | {{ else if eq $taxonomy "categories" }}
20 | {{ i18n "post.categories" }}
21 | {{ else }}
22 | {{ $label }}
23 | {{ end }}:
24 |
25 |
30 |
31 | {{- end }}
32 |
--------------------------------------------------------------------------------
/layouts/index.webappmanifest:
--------------------------------------------------------------------------------
1 | {{- /* 简洁的基础主题色 */ -}}
2 | {{- $themeColor := "#09090b" -}}
3 |
4 | {{- $manifest := dict
5 | "name" site.Title
6 | "short_name" (site.Params.shortName | default site.Title)
7 | "description" (site.Params.description | default "")
8 | "start_url" "/"
9 | "display" "standalone"
10 | "background_color" "#ffffff"
11 | "theme_color" $themeColor
12 | "orientation" "portrait-primary"
13 | "lang" (site.Params.language | default site.LanguageCode | default "zh-CN")
14 | "dir" "ltr"
15 | "scope" "/"
16 | "categories" (slice "blog" "technology" "education")
17 | -}}
18 |
19 | {{- if site.Params.favicon.svg -}}
20 | {{- $icons := slice (dict
21 | "src" site.Params.favicon.svg
22 | "sizes" "any"
23 | "type" "image/svg+xml"
24 | ) -}}
25 | {{- $manifest = merge $manifest (dict "icons" $icons) -}}
26 | {{- end -}}
27 |
28 | {{- $manifest | jsonify (dict "indent" " ") -}}
29 |
--------------------------------------------------------------------------------
/data/links.yaml:
--------------------------------------------------------------------------------
1 | social:
2 | - id: github
3 | title: GitHub
4 | description: The world's largest code hosting platform.
5 | url: https://github.com
6 | icon: https://github.com/fluidicon.png
7 |
8 |
9 | - id: linkedin
10 | title: LinkedIn
11 | description: Career Social Network.
12 | url: https://linkedin.com
13 |
14 |
15 |
16 |
17 | tool:
18 | - id: vercel
19 | title: Vercel
20 | description: Deploy and Development Platform.
21 | url: https://vercel.com
22 | icon: https://vercel.com/favicon.ico
23 |
24 |
25 | - id: netlify
26 | title: Netlify
27 | description: Deploy and Development Platform.
28 | url: https://netlify.com
29 | icon: https://netlify.com/favicon.ico
30 |
31 |
32 | - id: github-pages
33 | title: GitHub Pages
34 | description: Static Pages Hosting.
35 | url: https://pages.github.com
36 | icon: https://github.com/fluidicon.png
37 |
38 |
39 |
--------------------------------------------------------------------------------
/exampleSite/content/about.ja.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "について"
3 | layout: "about"
4 | summary: "Hugo Narrow テーマとその技術スタックについて"
5 | date: 2024-01-01T00:00:00+08:00
6 | links:
7 | - name: "Hugo ドキュメント"
8 | url: "https://gohugo.io/"
9 | icon: "https://gohugo.io/favicon.ico"
10 | description: "世界最速の静的サイトジェネレーター"
11 |
12 | - name: "Tailwind CSS"
13 | url: "https://tailwindcss.com/"
14 | icon: "https://tailwindcss.com/favicon.ico"
15 | description: "ユーティリティファーストの CSS フレームワーク"
16 |
17 | - name: "GitHub"
18 | url: "https://github.com/"
19 | icon: "https://github.com/fluidicon.png"
20 | description: "世界最大のコードホスティングプラットフォーム"
21 | ---
22 |
23 | ## について
24 |
25 | Hugo Narrow は、Tailwind CSS 4.0 で構築されたモダンでクリーンなミニマルな Hugo テーマです。ブログ/ポートフォリオテーマとして設計されており、複数のカラースキーム、ダークモードサポート、レスポンシブデザインなど、広範なカスタマイズオプションを備えています。
26 |
27 | ## 技術スタック
28 |
29 | - Hugo Extended
30 | - Tailwind CSS 4.0
31 | - @tailwindcss/typography
32 | - Glightbox
33 | - fjGallery
34 | - Macy.js
35 | - gumshoe
36 | - ...
--------------------------------------------------------------------------------
/assets/css/toc.css:
--------------------------------------------------------------------------------
1 | #toc-content nav {
2 | @apply text-sm leading-6;
3 | }
4 |
5 | #toc-content ul {
6 | @apply m-0 list-none p-0;
7 | }
8 |
9 | #toc-content li {
10 | @apply my-1 p-0;
11 | }
12 |
13 | #toc-content a {
14 | @apply text-muted-foreground hover:text-primary hover:bg-primary/10 relative block rounded-lg border-l-2 border-transparent px-4 py-3 no-underline transition-all duration-200 ease-out hover:translate-x-0.5 hover:-translate-y-px hover:scale-[1.02];
15 | }
16 |
17 | /* Gumshoe 添加的 active 类样式 */
18 | #toc-content a.active,
19 | #toc-content li.active > a {
20 | @apply text-primary bg-primary/10 translate-x-0.5 -translate-y-px scale-[1.02] font-medium;
21 | }
22 |
23 | #toc-content ul ul a {
24 | @apply pl-6;
25 | }
26 |
27 | #toc-content ul ul ul a {
28 | @apply pl-8;
29 | }
30 |
31 | #toc-content ul ul ul ul a {
32 | @apply pl-10;
33 | }
34 |
35 | #toc-content ul ul ul ul ul a {
36 | @apply pl-12;
37 | }
38 |
39 | #toc-content ul ul ul ul ul ul a {
40 | @apply pl-14;
41 | }
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/assets/css/gallery.css:
--------------------------------------------------------------------------------
1 | /* Justified Gallery 样式 */
2 | .fj-gallery .glightbox {
3 | @apply no-underline hover:no-underline focus:no-underline block overflow-hidden;
4 | border-radius: 0.5rem;
5 | }
6 |
7 | .fj-gallery-item {
8 | @apply overflow-hidden;
9 | border-radius: 0.5rem;
10 | }
11 |
12 | .fj-gallery img {
13 | @apply transition-transform duration-300 ease-in-out;
14 | border-radius: 0.5rem;
15 | }
16 |
17 | .fj-gallery img:hover {
18 | @apply scale-105;
19 | }
20 |
21 | .single-image .glightbox {
22 | @apply no-underline hover:no-underline focus:no-underline inline-block overflow-hidden;
23 | border-radius: 0.5rem;
24 | }
25 | .single-image .image-container {
26 | @apply overflow-hidden;
27 | border-radius: 0.5rem;
28 | }
29 |
30 | .single-image img {
31 | @apply transition-transform duration-300 ease-in-out;
32 | border-radius: 0.5rem;
33 | }
34 |
35 | .single-image img:hover {
36 | @apply scale-105;
37 | }
38 |
39 | .fj-gallery-item,
40 | .single-image .image-container {
41 | position: relative;
42 | }
--------------------------------------------------------------------------------
/exampleSite/content/about.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "About"
3 | layout: "about"
4 | summary: "Learn about Hugo Narrow theme and its technology stack"
5 | date: 2024-01-01T00:00:00+08:00
6 | links:
7 | - name: "Hugo Docs"
8 | url: "https://gohugo.io"
9 | icon: "https://gohugo.io/favicon.ico"
10 | description: "The world's fastest static site generator"
11 | - name: "Tailwindcss"
12 | url: "https://tailwindcss.com"
13 | description: "CSS framework"
14 | - name: "GitHub"
15 | url: "https://github.com"
16 | icon: "https://github.com/fluidicon.png"
17 | description: "The world's largest code hosting platform. "
18 |
19 |
20 | ---
21 |
22 | ## About
23 |
24 | Hugo Narrow is a modern, clean, and minimal Hugo theme built with Tailwind CSS 4.0. It's designed as a blog theme with extensive customization options including multiple color schemes, dark mode support, and responsive design.
25 |
26 | ## Technology Stack
27 |
28 | - Hugo Extended
29 | - Tailwind CSS 4.0
30 | - @tailwindcss/typography
31 | - Glightbox
32 | - fjGallery
33 | - Macy.js
34 | - gumshoe
35 | - ...
36 |
37 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2025 tom2almighty
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/layouts/_partials/content/custom_2.html:
--------------------------------------------------------------------------------
1 | {{/*
2 | 自定义内容示例 1 - 特色项目展示
3 | 文件位置: layouts/_partials/content/custom_1.html
4 | */}}
5 |
6 |
7 |
✨ 特色项目
8 |
9 |
10 |
11 |
12 |
项目名称 1
13 |
14 | 这是一个示例项目的简短描述,用于测试自定义内容功能。
15 |
16 |
17 | 了解更多 →
18 |
19 |
20 |
21 |
22 |
31 |
32 |
--------------------------------------------------------------------------------
/assets/icons/mastodon.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/layouts/_partials/ui/theme-switcher.html:
--------------------------------------------------------------------------------
1 | {{- if site.Params.showThemeSwitch | default true -}}
2 |
3 | {{- /* 准备主题菜单内容 */ -}}
4 | {{- $themeMenuContent := "" -}}
5 | {{- $themes := site.Params.themes -}}
6 | {{- $sortedThemes := slice -}}
7 | {{- range $key, $theme := $themes -}}
8 | {{- $sortedThemes = $sortedThemes | append (dict "key" $key "theme" $theme) -}}
9 | {{- end -}}
10 | {{- $sortedThemes = sort $sortedThemes "theme.order" -}}
11 | {{- range $sortedThemes -}}
12 | {{- $themeMenuContent = printf "%s" $themeMenuContent .key .theme.name -}}
13 | {{- end -}}
14 |
15 | {{- /* 使用统一的下拉菜单组件 */ -}}
16 | {{- partial "ui/dropdown-button.html" (dict
17 | "type" "color-scheme"
18 | "icon" "palette"
19 | "ariaLabel" (i18n "theme.toggle")
20 | "buttonId" "color-scheme-toggle"
21 | "dropdownId" "color-scheme-dropdown"
22 | "menuWidth" "w-44"
23 | "showCondition" true
24 | "content" (safeHTML $themeMenuContent)
25 | ) -}}
26 |
27 | {{- end -}}
28 |
--------------------------------------------------------------------------------
/layouts/index.json:
--------------------------------------------------------------------------------
1 | {{- .Scratch.Add "pages" slice -}}
2 |
3 | {{- .Scratch.Add "posts" slice -}}
4 | {{- range $index, $value := (where .Site.RegularPages "Section" "==" "posts") -}}
5 | {{- $.Scratch.Add "posts" (dict "title" $value.Title "text" $value.Plain "link" $value.RelPermalink) -}}
6 | {{- end -}}
7 |
8 | {{- .Scratch.Add "tags" slice -}}
9 | {{- range .Site.Taxonomies.tags -}}
10 | {{- $.Scratch.Add "tags" (dict "name" .Page.Title "slug" .Page.Title "link" .Page.RelPermalink) -}}
11 | {{- end -}}
12 |
13 | {{- .Scratch.Add "categories" slice -}}
14 | {{- range .Site.Taxonomies.categories -}}
15 | {{- $.Scratch.Add "categories" (dict "name" .Page.Title "slug" .Page.Title "link" .Page.RelPermalink ) -}}
16 | {{- end -}}
17 |
18 | {{- .Scratch.SetInMap "index" "pages" (.Scratch.Get "pages") }}
19 | {{- .Scratch.SetInMap "index" "posts" (.Scratch.Get "posts") }}
20 | {{- .Scratch.SetInMap "index" "tags" (.Scratch.Get "tags") }}
21 | {{- .Scratch.SetInMap "index" "categories" (.Scratch.Get "categories") }}
22 | {{- .Scratch.Get "index" | jsonify -}}
23 |
24 | {{- .Scratch.Delete "pages" -}}
25 | {{- .Scratch.Delete "posts" -}}
26 | {{- .Scratch.Delete "tags" -}}
27 | {{- .Scratch.Delete "categories" -}}
28 | {{- .Scratch.Delete "index" -}}
29 |
--------------------------------------------------------------------------------
/exampleSite/content/about.fr.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "À Propos"
3 | layout: "about"
4 | summary: "Découvrez le thème Hugo Narrow et sa pile technologique"
5 | date: 2024-01-01T00:00:00+08:00
6 | links:
7 | - name: "Documentation Hugo"
8 | url: "https://gohugo.io/"
9 | icon: "https://gohugo.io/favicon.ico"
10 | description: "Le générateur de sites statiques le plus rapide au monde"
11 |
12 | - name: "Tailwind CSS"
13 | url: "https://tailwindcss.com/"
14 | icon: "https://tailwindcss.com/favicon.ico"
15 | description: "Un framework CSS utilitaire-first"
16 |
17 | - name: "GitHub"
18 | url: "https://github.com/"
19 | icon: "https://github.com/fluidicon.png"
20 | description: "La plus grande plateforme d'hébergement de code au monde"
21 | ---
22 |
23 | ## À Propos
24 |
25 | Hugo Narrow est un thème Hugo moderne, épuré et minimaliste construit avec Tailwind CSS 4.0. Il est conçu comme un thème de blog/portfolio avec des options de personnalisation étendues incluant plusieurs schémas de couleurs, la prise en charge du mode sombre et un design responsive.
26 |
27 | ## Pile Technologique
28 |
29 | - Hugo Extended
30 | - Tailwind CSS 4.0
31 | - @tailwindcss/typography
32 | - Glightbox
33 | - fjGallery
34 | - Macy.js
35 | - gumshoe
36 | - ...
--------------------------------------------------------------------------------
/layouts/about.html:
--------------------------------------------------------------------------------
1 | {{ define "main" }}
2 |
3 | {{ partial "navigation/breadcrumb.html" . }}
4 |
5 |
6 |
16 |
17 |
18 |
19 |
20 | {{ .Content }}
21 |
22 |
23 |
24 |
25 | {{ $links := .Params.links }}
26 | {{ if $links }}
27 |
28 |
{{ T "links" }}
29 |
30 | {{ range $links }}
31 | {{ partial "content/link.html" (dict
32 | "title" .name
33 | "description" .description
34 | "url" .url
35 | "icon" .icon
36 | ) }}
37 | {{ end }}
38 |
39 |
40 | {{ end }}
41 | {{ partial "features/comments.html" . }}
42 | {{ end }}
--------------------------------------------------------------------------------
/assets/icons/wechat.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/layouts/_shortcodes/bilibili.html:
--------------------------------------------------------------------------------
1 |
2 | {{ $vid := (.Get 0) }}
3 | {{ $videopage := default 1 (.Get 1) }}
4 | {{ $basicQuery := querify "page" $videopage "high_quality" 1 "as_wide" 1 }}
5 | {{ $videoQuery := "" }}
6 | {{ if strings.HasPrefix (lower $vid) "av" }}
7 | {{ $videoQuery = querify "aid" (strings.TrimPrefix "av" (lower $vid)) }}
8 | {{ else if strings.HasPrefix (lower $vid) "bv" }}
9 | {{ $videoQuery = querify "bvid" $vid }}
10 | {{ else }}
11 |
12 |
Bilibili 视频av号或BV号错误!请检查视频av号或BV号是否正确
13 |
当前视频av或BV号:{{ $vid }},视频分P:{{ $videopage }}
14 |
15 | {{ end }}
16 |
--------------------------------------------------------------------------------
/layouts/_partials/features/comments/waline.html:
--------------------------------------------------------------------------------
1 | {{/* Waline 评论系统组件
2 |
3 | 简洁、安全的评论系统
4 |
5 | @context {page} . 当前文章页面对象
6 | @param {string} id 评论容器的唯一 ID
7 | */}}
8 |
9 | {{ $id := .id | default "waline-comments" }}
10 | {{ $config := .Site.Params.comments.waline }}
11 |
12 | {{ if $config.serverURL }}
13 |
14 |
15 | {{/* 加载 Waline CSS */}}
16 |
19 |
20 | {{/* 加载 Waline JS */}}
21 |
31 | {{ else }}
32 |
33 |
35 | {{ partial "features/icon.html" (dict "name" "message-circle" "size" "lg" "ariaLabel" "") }}
36 |
37 |
38 | {{ i18n "comments.waline_not_configured" | default "Waline 未配置" }}
39 |
40 |
41 | {{ i18n "comments.waline_config_desc" | default "请在站点配置中设置 Waline 服务器地址" }}
42 |
43 |
44 | {{ end }}
45 |
--------------------------------------------------------------------------------
/layouts/_partials/content/related-posts.html:
--------------------------------------------------------------------------------
1 | {{/* 相关文章组件
2 |
3 | 显示与当前文章相关的其他文章
4 |
5 | @context {page} . 当前文章页面对象
6 | */}}
7 |
8 | {{/* 获取配置参数 */}}
9 | {{ $relatedCount := .Site.Params.post.relatedPostsCount | default 3 }}
10 | {{ $showRelated := .Params.showRelated | default .Site.Params.post.showRelated | default true }}
11 | {{ $related := .Site.RegularPages.Related . | first $relatedCount }}
12 |
13 | {{ if and $showRelated $related }}
14 |
15 |
16 |
17 | {{ partial "features/icon.html" (dict "name" "related" "size" "md" "ariaLabel" "") }}
18 |
19 | {{ i18n "post.related_posts" | default "相关文章" }}
20 |
21 |
22 |
23 |
24 |
37 |
38 | {{ end }}
--------------------------------------------------------------------------------
/exampleSite/content/posts/katex-mermaid-test.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "KaTeX and Mermaid Test"
3 | date: 2024-01-16T23:30:00+08:00
4 | draft: false
5 | description: "Testing KaTeX and Mermaid features"
6 | katex: true
7 | mermaid: true
8 | tags: ['Math', 'Mermaid']
9 | ---
10 |
11 | # KaTeX and Mermaid Test
12 |
13 | This article is used to test the KaTeX and Mermaid features.
14 |
15 | ## Configuration
16 |
17 | ### Frontmatter Configuration
18 | ```yaml
19 | ---
20 | katex: true
21 | mermaid: true
22 | ---
23 | ```
24 |
25 | ### Global Configuration
26 | ```yaml
27 | # hugo.yaml
28 | katex:
29 | enabled: true
30 | delimiters:
31 | - left: "$$"
32 | right: "$$"
33 | display: true
34 | - left: "$"
35 | right: "$"
36 | display: false
37 |
38 | mermaid:
39 | enabled: true
40 | ```
41 |
42 | ## KaTeX Test
43 |
44 | ### Inline Formula
45 |
46 | This is an inline formula: $E = mc^2$, Einstein's mass-energy equivalence formula.
47 |
48 | Another example:When $a \neq 0$, the solutions to the quadratic equation $ax^2 + bx + c = 0$ are $x = \frac{-b \pm \sqrt{b^2-4ac}}{2a}$.
49 |
50 | ### Block Formula
51 | #### Quadratic Formula
52 | $$x = \frac{-b \pm \sqrt{b^2-4ac}}{2a}$$
53 |
54 | #### Euler's Formula
55 | $$e^{i\pi} + 1 = 0$$
56 |
57 | #### Integral Formula
58 | $$\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}$$
59 |
60 | #### Matrix Representation
61 | $$\begin{pmatrix} a & b \\\\ c & d \end{pmatrix} \begin{pmatrix} x \\\\ y \end{pmatrix} = \begin{pmatrix} ax + by \\\\ cx + dy \end{pmatrix}$$
62 |
63 | #### Summation Formula
64 | $$\sum_{n=1}^{\infty} \frac{1}{n^2} = \frac{\pi^2}{6}$$
65 |
66 | #### Common Mathematical Symbols Test
67 | Using predefined macros: $\RR$, $\NN$, $\ZZ$, $\QQ$, $\CC$
68 |
--------------------------------------------------------------------------------
/theme.toml:
--------------------------------------------------------------------------------
1 | name = "Hugo Narrow"
2 | license = "MIT"
3 | licenselink = "https://github.com/tom2almighty/hugo-narrow/blob/main/LICENSE"
4 | description = "A modern, clean, and minimal Hugo theme built with Tailwind CSS 4.0. Support custom themes, dark mode, and responsive design."
5 | homepage = "https://github.com/tom2almighty/hugo-narrow"
6 | demosite = "https://hugo-narrow.vercel.app/"
7 | tags = [
8 | "blog",
9 | "personal",
10 | "portfolio",
11 | "responsive",
12 | "tailwindcss",
13 | "tailwindcss 4.0",
14 | "dark-mode",
15 | "custom-theme",
16 | "modern",
17 | "clean",
18 | "minimal"
19 | ]
20 | features = [
21 | "Tailwind CSS 4.0",
22 | "custom theme support",
23 | "dark mode support",
24 | "responsive design",
25 | "toc support",
26 | "search support",
27 | "comments support",
28 | "analytics support",
29 | "code highlighting",
30 | "math support",
31 | "Mermaid support"
32 | ]
33 | min_version = "0.146.0"
34 | browser_support = [
35 | "Chrome >= 90",
36 | "Firefox >= 88",
37 | "Safari >= 14",
38 | "Edge >= 90"
39 | ]
40 |
41 |
42 | [author]
43 | name = "tom2almighty"
44 | homepage = "https://github.com/tom2almighty"
45 |
46 | [[dependencies]]
47 | name = "Tailwind CSS"
48 | version = "^4.0.0"
49 | description = "CSS framework"
50 |
51 | [[dependencies]]
52 | name = "@tailwindcss/typography"
53 | version = "^0.5.0"
54 | description = "Typography plugin"
55 |
56 | [hugo]
57 | min = "0.146.0"
58 | extended = true
59 |
60 | [theme_features]
61 | responsive = true
62 | dark_mode = true
63 | multilingual = true
64 | search = true
65 | comments = true
66 | analytics = true
67 | syntax_highlighting = true
68 | math = true
69 | diagrams = true
70 |
71 | [build_requirements]
72 | node = ">=18.0.0"
73 | npm = ">=8.0.0"
74 | hugo_extended = true
--------------------------------------------------------------------------------
/layouts/404.html:
--------------------------------------------------------------------------------
1 | {{ define "main" }}
2 |
3 |
4 |
7 |
8 |
9 |
10 | Page Not Found
11 |
12 |
13 |
14 |
15 | Sorry, the page you are looking for does not exist or has been removed.
16 |
17 |
18 |
19 |
36 |
37 |
38 |
39 | {{ end }}
40 |
--------------------------------------------------------------------------------
/exampleSite/content/posts/render-image/index.zh-cn.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "图片渲染测试"
3 | date: 2024-01-16T22:30:00+08:00
4 | draft: false
5 | description: "测试图片渲染功能"
6 | tags: ["测试", "图片", "渲染"]
7 | categories: ["图片渲染"]
8 | lightbox:
9 | enabled: true
10 | justified_gallery:
11 | enabled: true
12 | ---
13 |
14 | # 图片渲染测试
15 | 示例来自 [LightGallery](https://www.lightgalleryjs.com/demos/thumbnails/)
16 | 所有图片来自 [Unsplash](https://unsplash.com/)
17 |
18 | ## 单张图片
19 | 
20 |
21 | ## Justified 布局图库
22 | 
23 | 
24 | 
25 | 
26 | 
27 | 
28 | 
29 | 
30 |
31 | ## 瀑布流布局 - 短代码
32 | {{< masonry columns=4 gutter=15 >}}
33 | 
34 | 
35 | 
36 | 
37 | 
38 | 
39 | 
40 | 
41 | {{< /masonry >}}
42 |
43 |
--------------------------------------------------------------------------------
/exampleSite/content/posts/render-image/index.ja.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "画像レンダリングテスト"
3 | date: 2024-01-16T22:30:00+08:00
4 | draft: false
5 | description: "画像レンダリング機能のテスト"
6 | tags: ["テスト", "画像", "レンダリング"]
7 | categories: ["画像レンダリング"]
8 | lightbox:
9 | enabled: true
10 | justified_gallery:
11 | enabled: true
12 | ---
13 |
14 | # 画像レンダリングテスト
15 | デモは [LightGallery](https://www.lightgalleryjs.com/demos/thumbnails/) から引用。
16 | すべての画像は [Unsplash](https://unsplash.com/) より。
17 |
18 | ## 単一画像
19 | 
20 |
21 | ## 整列ギャラリー
22 | 
23 | 
24 | 
25 | 
26 | 
27 | 
28 | 
29 | 
30 |
31 |
32 | ## ショートコードによるメイソンリー
33 | {{< masonry columns=4 gutter=15 >}}
34 | 
35 | 
36 | 
37 | 
38 | 
39 | 
40 | 
41 | 
42 | {{< /masonry >}}
43 |
44 |
--------------------------------------------------------------------------------
/layouts/_markup/render-image.html:
--------------------------------------------------------------------------------
1 | {{/*
2 | Hugo Markdown 图片渲染器
3 | 处理业务逻辑:灯箱功能、类名、结构等
4 | */}}
5 |
6 | {{- $dest := .Destination | safeURL -}}
7 | {{- $alt := .Text -}}
8 | {{- $caption := .Title -}}
9 |
10 | {{/* 检查是否启用灯箱功能 */}}
11 | {{- $globalLightbox := site.Params.lightbox | default dict -}}
12 | {{- $pageLightbox := .Page.Params.lightbox | default dict -}}
13 | {{- $lightboxEnabled := false -}}
14 |
15 | {{/* 优先使用页面级配置,然后是全局配置 */}}
16 | {{- if isset $pageLightbox "enabled" -}}
17 | {{- $lightboxEnabled = $pageLightbox.enabled -}}
18 | {{- else if isset $globalLightbox "enabled" -}}
19 | {{- $lightboxEnabled = $globalLightbox.enabled -}}
20 | {{- end -}}
21 |
22 | {{/* 使用图片处理器获取数据 */}}
23 | {{- partial "content/image-processor.html" (dict
24 | "context" .Page
25 | "src" $dest
26 | "alt" $alt
27 | "caption" $caption
28 | "enablePlaceholder" false
29 | "outputType" "data"
30 | ) -}}
31 |
32 | {{/* 获取处理结果 */}}
33 | {{- $imageUrl := .Page.Scratch.Get "imageUrl" -}}
34 | {{- $imageResource := .Page.Scratch.Get "imageResource" -}}
35 | {{- $isExternal := .Page.Scratch.Get "isExternal" -}}
36 | {{- $canProcess := .Page.Scratch.Get "canProcess" -}}
37 | {{- $processedImages := .Page.Scratch.Get "processedImages" -}}
38 |
39 | {{/* 生成 figure 元素 */}}
40 |
43 |
44 | {{/* 使用图片处理器生成图片HTML */}}
45 | {{- partial "content/image-processor.html" (dict
46 | "context" .Page
47 | "src" $dest
48 | "alt" $alt
49 | "caption" $caption
50 | "enablePlaceholder" false
51 | "outputType" "img"
52 | ) -}}
53 |
54 |
55 | {{/* 图片说明 */}}
56 | {{- if $caption -}}
57 |
58 | {{ $caption | .Page.RenderString }}
59 |
60 | {{- end -}}
61 |
--------------------------------------------------------------------------------
/layouts/_partials/ui/dark-mode-switcher.html:
--------------------------------------------------------------------------------
1 | {{- if site.Params.showDarkModeSwitch | default true -}}
2 |
3 | {{- /* 准备暗色模式菜单内容 */ -}}
4 | {{- $darkModeMenuContent := "" -}}
5 | {{- $darkModeMenuContent = printf "%s" $darkModeMenuContent (partial "features/icon.html" (dict "name" "sun" "class" "mr-3 h-4 w-4" "size" "md" "ariaLabel" (i18n "theme.light"))) (i18n "theme.light") -}}
6 | {{- $darkModeMenuContent = printf "%s" $darkModeMenuContent (partial "features/icon.html" (dict "name" "moon" "class" "mr-3 h-4 w-4" "size" "md" "ariaLabel" (i18n "theme.dark"))) (i18n "theme.dark") -}}
7 | {{- $darkModeMenuContent = printf "%s" $darkModeMenuContent (partial "features/icon.html" (dict "name" "monitor" "class" "mr-3 h-4 w-4" "size" "md" "ariaLabel" (i18n "theme.system"))) (i18n "theme.system") -}}
8 |
9 | {{- /* 使用统一的下拉菜单组件 */ -}}
10 | {{- partial "ui/dropdown-button.html" (dict
11 | "type" "theme"
12 | "icon" ""
13 | "ariaLabel" (i18n "theme.toggle")
14 | "buttonId" "theme-toggle"
15 | "dropdownId" "theme-dropdown"
16 | "menuWidth" "w-40"
17 | "showCondition" true
18 | "content" (safeHTML $darkModeMenuContent)
19 | ) -}}
20 |
21 | {{- end -}}
22 |
--------------------------------------------------------------------------------
/layouts/baseof.html:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | {{ partial "layout/head.html" . }}
7 |
33 |
34 |
35 |
36 |
37 | {{ partial "ui/reading-progress.html" . }}
38 |
39 | {{ partial "navigation/header.html" . }}
40 |
41 |
42 | {{ block "main" . }}{{ end }}
43 |
44 |
45 | {{ partial "layout/footer.html" . }}
46 |
47 |
48 | {{ partial "ui/dock.html" . }}
49 |
50 |
51 | {{- if and .IsPage .TableOfContents }}
52 | {{ partial "ui/toc-card.html" . }}
53 | {{- end }}
54 | {{ partial "features/katex.html" . }}
55 | {{ partial "features/mermaid.html" . }}
56 |
57 |
58 | {{ partial "ui/search-modal.html" . }}
59 |
60 |
61 |
--------------------------------------------------------------------------------
/layouts/_partials/config/gallery.html:
--------------------------------------------------------------------------------
1 | {{/* Gallery 配置管理 */}}
2 | {{ $globalJustified := site.Params.justified_gallery | default dict }}
3 | {{ $globalLightbox := site.Params.lightbox | default dict }}
4 |
5 | {{ $pageJustified := .Params.justified_gallery | default dict }}
6 | {{ $pageLightbox := .Params.lightbox | default dict }}
7 |
8 | {{/* 计算最终配置 */}}
9 | {{ $justifiedEnabled := cond (isset $pageJustified "enabled") $pageJustified.enabled ($globalJustified.enabled | default false) }}
10 | {{ $lightboxEnabled := cond (isset $pageLightbox "enabled") $pageLightbox.enabled ($globalLightbox.enabled | default false) }}
11 |
12 | {{/* 合并配置对象 */}}
13 | {{ $justifiedConfig := $globalJustified }}
14 | {{ if $pageJustified }}
15 | {{ $justifiedConfig = merge $justifiedConfig $pageJustified }}
16 | {{ end }}
17 |
18 | {{ $lightboxConfig := $globalLightbox }}
19 | {{ if $pageLightbox }}
20 | {{ $lightboxConfig = merge $lightboxConfig $pageLightbox }}
21 | {{ end }}
22 |
23 | {{/* 处理配置值,确保类型正确 */}}
24 | {{ $cleanJustifiedConfig := dict }}
25 | {{ range $key, $value := $justifiedConfig }}
26 | {{ if ne $key "enabled" }}
27 | {{ $cleanJustifiedConfig = merge $cleanJustifiedConfig (dict $key $value) }}
28 | {{ end }}
29 | {{ end }}
30 |
31 | {{ $cleanLightboxConfig := dict }}
32 | {{ range $key, $value := $lightboxConfig }}
33 | {{ if ne $key "enabled" }}
34 | {{ $cleanLightboxConfig = merge $cleanLightboxConfig (dict $key $value) }}
35 | {{ end }}
36 | {{ end }}
37 |
38 | {{/* 设置页面级变量 */}}
39 | {{ .Scratch.Set "justifiedEnabled" $justifiedEnabled }}
40 | {{ .Scratch.Set "lightboxEnabled" $lightboxEnabled }}
41 | {{ .Scratch.Set "justifiedConfig" $cleanJustifiedConfig }}
42 | {{ .Scratch.Set "lightboxConfig" $cleanLightboxConfig }}
43 |
44 | {{/* 生成 JavaScript 配置 */}}
45 |
--------------------------------------------------------------------------------
/exampleSite/content/posts/render-image/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Image Rendering Test"
3 | date: 2024-01-16T22:30:00+08:00
4 | draft: false
5 | description: "Testing the simple image rendering features"
6 | tags: ["test", "image", "rendering"]
7 | categories: ["image-rendering"]
8 | lightbox:
9 | enabled: true
10 | justified_gallery:
11 | enabled: true
12 | ---
13 |
14 | # Image Rendering Test
15 | The Demo comes from [LightGallery](https://www.lightgalleryjs.com/demos/thumbnails/)
16 | All images are from [Unsplash](https://unsplash.com/)
17 |
18 | ## Single Image
19 | 
20 |
21 | ## Justified Gallery
22 | 
23 | 
24 | 
25 | 
26 | 
27 | 
28 | 
29 | 
30 |
31 | ## Masonry by shortcodes
32 | {{< masonry columns=4 gutter=15 >}}
33 | 
34 | 
35 | 
36 | 
37 | 
38 | 
39 | 
40 | 
41 | {{< /masonry >}}
--------------------------------------------------------------------------------
/exampleSite/content/posts/render-image/index.fr.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Test de rendu d'image"
3 | date: 2024-01-16T22:30:00+08:00
4 | draft: false
5 | description: "Test des fonctionnalités de rendu d'image"
6 | tags: ["test", "image", "rendu"]
7 | categories: ["rendu-image"]
8 | lightbox:
9 | enabled: true
10 | justified_gallery:
11 | enabled: true
12 | ---
13 |
14 | # Test de rendu d'image
15 | La démo provient de [LightGallery](https://www.lightgalleryjs.com/demos/thumbnails/)
16 | Toutes les images proviennent de [Unsplash](https://unsplash.com/)
17 |
18 | ## Image unique
19 | 
20 |
21 | ## Galerie justifiée
22 | 
23 | 
24 | 
25 | 
26 | 
27 | 
28 | 
29 | 
30 |
31 | ## Maçonnerie par codes courts
32 | {{< masonry columns=4 gutter=15 >}}
33 | 
34 | 
35 | 
36 | 
37 | 
38 | 
39 | 
40 | 
41 | {{< /masonry >}}
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | # Hugo Narrow
4 |
5 | A Modern Hugo Theme with Multiple Color Schemes - Built on TailwindCSS 4.
6 |
7 |
8 | ## ✨ Features
9 |
10 | - Multiple Color Schemes
11 | - Custom Colors
12 | - Dark Mode
13 | - Table of Contents
14 | - Search Functionality
15 | - Comment Systems
16 | - Analytics Systems
17 | - Enhanced Markdown
18 | - Enhanced Code Blocks
19 | - Multilingual Support
20 | - Katex Support
21 | - Mermaid Support
22 | - Lightbox by GLightbox
23 | - Justified Gallery with markdown
24 | - Masonry Gallery with shortcode
25 |
26 | ## 📕 Documentation
27 |
28 | Please visit [Hugo Narrow Docs](https://hugo-narrow-docs.vercel.app/) get full documentation.
29 |
30 | ## 🔗 Demo
31 |
32 | This demo site is hosted by Vercel, click to visit [Demo](https://hugo-narrow.vercel.app/).
33 |
34 |
35 | ## 📄 License
36 |
37 | This project is open source under the [MIT License](LICENSE).
38 |
39 | ## 🙏 Acknowledgments
40 |
41 | - [Hugo](https://gohugo.io/) - Static site generator.
42 | - [Tailwind CSS](https://tailwindcss.com/) - CSS framework.
43 | - [KaTeX](https://katex.org/) - Math formula rendering.
44 | - [gumshoe](https://github.com/cferdinandi/gumshoe) - TOC scrollspy.
45 | - [Mermaid](https://mermaid.js.org/) - Chart library.
46 | - [Daisyui](https://daisyui.com/) - Color Scheme reference.
47 | - [Tweakcn](https://tweakcn.com/) - Color Scheme reference.
48 | - [Hexo Theme icarus](https://github.com/ppoffice/hexo-theme-icarus) - Search functionality reference.
49 | - [Hugo Theme Stack](https://stack.jimmycai.com/) - Bilibili and Tencent Video shortcodes.
50 | - [Vercel](https://vercel.com) - Demo Site.
51 | - [iconify](https://iconify.design/) - Get icons here, thanks to all open source icon sets.
52 | - [Glightbox](https://github.com/biati-digital/glightbox) - Lightbox library.
53 | - [flickr-justified-gallery](https://github.com/nk-o/flickr-justified-gallery) - Justified image gallery.
54 | - [Macy.js](https://github.com/bigbite/macy.js) - Masonry layout library.
55 | - [Augment Code](https://www.augmentcode.com/) - Programming assistant.
56 |
57 | ---
58 |
59 | ⭐ If this theme helps you, please give it a Star!
--------------------------------------------------------------------------------
/layouts/_partials/layout/head.html:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 | {{- if .IsHome -}}{{ site.Title }}{{- else if .Title -}}{{ .Title }} | {{ site.Title }}{{- else -}}{{ site.Title }}{{- end -}}
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | {{ with site.Params.favicon.svg }}
19 |
20 | {{ else }}
21 |
22 |
23 | {{ end }}
24 |
25 |
26 |
27 | {{ partial "layout/head/seo.html" . }}
28 |
29 |
30 |
31 |
36 |
37 |
38 | {{ partial "config/gallery.html" . }}
39 | {{ partial "layout/head/css.html" . }}
40 | {{ partial "layout/head/js.html" . }}
41 |
--------------------------------------------------------------------------------
/i18n/zh-tw.yaml:
--------------------------------------------------------------------------------
1 | # 繁體中文語言文件
2 | # 導航相關
3 | nav:
4 | menu: "選單"
5 | home: "首頁"
6 | posts: "文章"
7 | tags: "標籤"
8 | categories: "分類"
9 | about: "關於"
10 | contact: "聯絡"
11 | archive: "歸檔"
12 | archives: "歸檔"
13 | search: "搜尋"
14 | breadcrumb: "麵包屑導航"
15 | pagination: "分頁導航"
16 | prev: "上一頁"
17 | next: "下一頁"
18 | prev_page: "上一頁"
19 | next_page: "下一頁"
20 | page_info: "第 {{ .current }} 頁,共 {{ .total }} 頁"
21 | total_pages: "共 {{ .count }} 頁"
22 | back_home: "返回首頁"
23 | post_navigation: "文章導航"
24 |
25 | # 主題相關
26 | theme:
27 | toggle: "切換主題風格"
28 | light: "亮色"
29 | dark: "暗色"
30 | system: "跟隨系統"
31 | auto: "自動"
32 |
33 | # 頁腳相關
34 | footer:
35 | copyright: "版權所有"
36 | all_rights_reserved: "保留所有權利"
37 | about_us: "關於我們"
38 | contact_us: "聯絡方式"
39 | privacy_policy: "隱私政策"
40 | terms_of_service: "服務條款"
41 | rss_feed: "RSS 訂閱"
42 |
43 | # 首頁相關
44 | home:
45 | recent_posts: "最近文章"
46 | showing_posts: "顯示最新"
47 | posts: "篇文章"
48 | view_all_posts: "查看所有文章"
49 |
50 | # 文章相關
51 | post:
52 | read_more: "閱讀更多"
53 | published_on: "發布於"
54 | updated_on: "更新於"
55 | tags: "標籤"
56 | categories: "分類"
57 | share: "分享"
58 | previous: "上一篇"
59 | next: "下一篇"
60 | related_posts: "相關文章"
61 | reading_time: "閱讀時間"
62 | no_posts: "暫無文章"
63 | no_posts_desc: "還沒有發布任何文章,請稍後再來查看。"
64 | list_desc: "這裡是所有已發布的文章,按時間倒序排列。"
65 | total_posts: "共 {{ .count }} 篇文章"
66 | author: "作者"
67 | words: "字"
68 | words_count: "字數"
69 | no_previous: "沒有上一篇"
70 | no_next: "沒有下一篇"
71 | no_previous_desc: "這是最早的文章"
72 | no_next_desc: "這是最新的文章"
73 | view_more_posts: "查看更多文章"
74 | reading_time_unit: "分鐘"
75 |
76 | # 分頁相關
77 | pagination:
78 | previous: "上一頁"
79 | next: "下一頁"
80 | page: "第"
81 | of: "頁,共"
82 | pages: "頁"
83 |
84 | # 搜尋相關
85 | search:
86 | placeholder: "搜尋文章..."
87 | clear: "清空"
88 | close: "關閉"
89 | loading: "搜尋中..."
90 | empty_title: "開始搜尋"
91 | empty_description: "輸入關鍵詞搜尋文章內容"
92 | no_results_title: "未找到結果"
93 | no_results_description: "嘗試使用不同的關鍵詞"
94 | results_count: "找到 %d 個結果"
95 | match_score: "匹配度"
96 | hint_navigate: "導航"
97 | hint_select: "選擇"
98 | hint_close: "關閉"
99 | hint_shortcut: "快捷鍵"
100 |
101 | # 連結
102 | links: "連結"
103 |
--------------------------------------------------------------------------------
/layouts/_partials/layout/head/css.html:
--------------------------------------------------------------------------------
1 | {{/* {{ with (templates.Defer (dict "key" "global")) }}
2 | {{ with resources.Get "css/main.css" }}
3 | {{ $opts := dict "minify" (not hugo.IsDevelopment) }}
4 | {{ with . | css.TailwindCSS $opts }}
5 | {{ if hugo.IsDevelopment }}
6 |
7 | {{ else }}
8 | {{ with . | fingerprint }}
9 |
14 | {{ end }}
15 | {{ end }}
16 | {{ end }}
17 | {{ end }}
18 | {{ end }} */}}
19 |
20 | {{/* main css */}}
21 | {{ with resources.Get "css/compiled.css" }}
22 | {{ if hugo.IsDevelopment }}
23 |
24 | {{ else }}
25 | {{ with . | minify | fingerprint }}
26 |
31 | {{ end }}
32 | {{ end }}
33 | {{ end }}
34 |
35 |
36 | {{/* chroma styles */}}
37 | {{ with resources.Get "css/chroma.css" }}
38 | {{ if hugo.IsDevelopment }}
39 |
40 | {{ else }}
41 | {{ with . | minify | fingerprint }}
42 |
47 | {{ end }}
48 | {{ end }}
49 | {{ end }}
50 |
51 |
52 | {{/* custom styles */}}
53 | {{ range (resources.Match "css/custom/*.css") }}
54 | {{ if hugo.IsDevelopment }}
55 |
56 | {{ else }}
57 | {{ with . | minify | fingerprint }}
58 |
63 | {{ end }}
64 | {{ end }}
65 | {{ end }}
66 |
67 | {{/* 图片画廊CSS - 条件加载 */}}
68 | {{ if .Scratch.Get "justifiedEnabled" }}
69 |
70 | {{ end }}
71 |
72 | {{ if .Scratch.Get "lightboxEnabled" }}
73 |
74 | {{ end }}
75 |
--------------------------------------------------------------------------------
/layouts/_partials/content/post-list.html:
--------------------------------------------------------------------------------
1 | {{/* 文章列表组件
2 |
3 | 显示文章卡片列表
4 |
5 | @context {slice} .posts 文章列表
6 | @context {string} .title 列表标题 (可选)
7 | @context {bool} .showTitle 是否显示标题 (默认: false)
8 | @context {bool} .showViewAll 是否显示"查看所有"按钮 (默认: false)
9 | @context {string} .viewAllUrl "查看所有"按钮的链接 (默认: /posts/)
10 | */}}
11 |
12 | {{ $posts := .posts }}
13 | {{ $title := .title | default "" }}
14 | {{ $showTitle := .showTitle | default false }}
15 | {{ $showViewAll := .showViewAll | default false }}
16 | {{ $viewAllUrl := .viewAllUrl | default ("/posts/" | relLangURL) }}
17 |
18 | {{ if $posts }}
19 |
20 |
21 | {{ if and $showTitle $title }}
22 |
23 |
{{ $title }}
24 |
25 | {{ end }}
26 |
27 |
28 |
29 |
30 | {{ range $posts }}
31 | {{ partial "content/card-base.html" (dict "page" .) }}
32 | {{ end }}
33 |
34 |
35 |
36 | {{ if $showViewAll }}
37 |
46 | {{ end }}
47 |
48 |
49 | {{ else }}
50 |
51 |
52 |
54 | {{ partial "features/icon.html" (dict "name" "folder" "size" "lg" "ariaLabel" "") }}
55 |
56 |
57 | {{ i18n "post.no_posts" | default "暂无文章" }}
58 |
59 |
60 | {{ i18n "post.no_posts_desc" | default "还没有发布任何文章,请稍后再来查看。" }}
61 |
62 |
63 | {{ end }}
64 |
--------------------------------------------------------------------------------
/layouts/_partials/features/comments/twikoo.html:
--------------------------------------------------------------------------------
1 | {{/* Twikoo 评论系统组件
2 |
3 | 简洁、安全的评论系统
4 |
5 | @context {page} . 当前文章页面对象
6 | @param {string} id 评论容器的唯一 ID
7 | */}}
8 |
9 | {{ $id := .id | default "twikoo-comments" }}
10 | {{ $config := .Site.Params.comments.twikoo }}
11 |
12 | {{ if $config.envId }}
13 |
14 |
15 | {{/* 加载 Twikoo JS */}}
16 |
17 |
18 |
59 | {{ else }}
60 |
61 |
63 | {{ partial "features/icon.html" (dict "name" "cloud" "size" "lg" "ariaLabel" "") }}
64 |
65 |
66 | {{ i18n "comments.twikoo_not_configured" | default "Twikoo 未配置" }}
67 |
68 |
69 | {{ i18n "comments.twikoo_config_desc" | default "请在站点配置中设置 Twikoo 环境 ID" }}
70 |
71 |
72 | {{ end }}
73 |
--------------------------------------------------------------------------------
/layouts/_partials/navigation/mobile-menu-toggle.html:
--------------------------------------------------------------------------------
1 |
2 |
57 |
--------------------------------------------------------------------------------
/layouts/_partials/features/comments/utterances.html:
--------------------------------------------------------------------------------
1 | {{/* Utterances 评论系统组件
2 |
3 | 基于 GitHub Issues 的轻量级评论系统
4 |
5 | @context {page} . 当前文章页面对象
6 | @param {string} id 评论容器的唯一 ID
7 | */}}
8 |
9 | {{ $id := .id | default "utterances-comments" }}
10 | {{ $config := .Site.Params.comments.utterances }}
11 |
12 | {{ if $config.repo }}
13 |
14 |
22 |
23 |
24 | {{/* 主题切换支持 */}}
25 |
63 | {{ else }}
64 |
65 |
67 | {{ partial "features/icon.html" (dict "name" "github" "size" "lg" "ariaLabel" "") }}
68 |
69 |
70 | {{ i18n "comments.utterances_not_configured" | default "Utterances 未配置" }}
71 |
72 |
73 | {{ i18n "comments.utterances_config_desc" | default "请在站点配置中设置 GitHub 仓库信息" }}
74 |
75 |
76 | {{ end }}
77 |
--------------------------------------------------------------------------------
/layouts/posts/single.html:
--------------------------------------------------------------------------------
1 | {{ define "main" }}
2 |
3 | {{ partial "navigation/breadcrumb.html" . }}
4 |
5 |
6 |
7 | {{- if .Params.cover -}}
8 | {{/* 使用通用图片处理器 */}}
9 | {{- partial "content/image-processor.html" (dict
10 | "context" .
11 | "src" .Params.cover
12 | "alt" .Title
13 | "enableModal" false
14 | "enableResponsive" true
15 | "enablePlaceholder" false
16 | "outputType" "data"
17 | ) -}}
18 | {{- $coverImage := .Scratch.Get "imageUrl" -}}
19 | {{- $imageResource := .Scratch.Get "imageResource" -}}
20 | {{- $placeholderData := .Scratch.Get "placeholderData" | default dict -}}
21 | {{- $gradients := $placeholderData.gradients | default (slice "from-blue-500/20 to-purple-500/10") -}}
22 | {{- $colorIndex := $placeholderData.colorIndex | default 0 -}}
23 |
24 | {{- if $coverImage -}}
25 |
26 |

32 |
33 |
34 |
35 |
36 | {{ substr .Title 0 1 | upper }}
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 | {{- end -}}
45 | {{ end }}
46 |
47 |
48 |
49 |
50 | {{ partial "content/post-meta.html" . }}
51 |
52 |
53 |
54 |
55 | {{ .Content }}
56 |
57 |
58 |
59 | {{ partial "content/post-license.html" . }}
60 |
61 |
62 |
63 | {{ partial "content/post-navigation.html" . }}
64 |
65 |
66 |
67 | {{ partial "content/related-posts.html" . }}
68 |
69 |
70 |
71 | {{ partial "features/comments.html" . }}
72 |
73 | {{ end }}
74 |
--------------------------------------------------------------------------------
/layouts/_partials/content/image-processor.html:
--------------------------------------------------------------------------------
1 | {{/*
2 | 图片处理器
3 | */}}
4 |
5 | {{- $context := .context -}}
6 | {{- $src := .src | string -}}
7 | {{- $alt := .alt | default "" -}}
8 | {{- $caption := .caption | default "" -}}
9 | {{- $enablePlaceholder := .enablePlaceholder | default true -}}
10 | {{- $outputType := .outputType | default "both" -}}
11 |
12 | {{/* 初始化核心变量 */}}
13 | {{- $resource := false -}}
14 | {{- $resourceType := "" -}}
15 | {{- $isExternal := false -}}
16 | {{- $finalUrl := "" -}}
17 |
18 | {{/* 检查是否为外部URL */}}
19 | {{- if or (hasPrefix $src "http://") (hasPrefix $src "https://") -}}
20 | {{- $isExternal = true -}}
21 | {{- $resourceType = "external" -}}
22 | {{- $finalUrl = $src -}}
23 | {{- else -}}
24 | {{/* 本地资源处理 */}}
25 | {{- $searchPath := $src -}}
26 | {{- if hasPrefix $src "./" -}}
27 | {{- $searchPath = strings.TrimPrefix "./" $src -}}
28 | {{- else if hasPrefix $src "/" -}}
29 | {{- $searchPath = strings.TrimPrefix "/" $src -}}
30 | {{- end -}}
31 |
32 | {{/* 优先级查找:页面资源 -> 全局资源 -> 静态文件 */}}
33 | {{- with $context.Resources.GetMatch $searchPath -}}
34 | {{- $resource = . -}}
35 | {{- $resourceType = "page" -}}
36 | {{- $finalUrl = .RelPermalink -}}
37 | {{- else -}}
38 | {{- with resources.Get $searchPath -}}
39 | {{- $resource = . -}}
40 | {{- $resourceType = "global" -}}
41 | {{- $finalUrl = .RelPermalink -}}
42 | {{- else -}}
43 | {{- $resourceType = "static" -}}
44 | {{- $finalUrl = $src -}}
45 | {{- end -}}
46 | {{- end -}}
47 | {{- end -}}
48 |
49 | {{/* 设置核心数据到上下文 */}}
50 | {{- if or (eq $outputType "data") (eq $outputType "both") -}}
51 | {{- $context.Scratch.Set "imageResource" $resource -}}
52 | {{- $context.Scratch.Set "imageUrl" $finalUrl -}}
53 | {{- $context.Scratch.Set "imageType" $resourceType -}}
54 | {{- $context.Scratch.Set "isExternal" $isExternal -}}
55 | {{- end -}}
56 |
57 | {{/* 生成图片HTML */}}
58 | {{- if or (eq $outputType "img") (eq $outputType "both") -}}
59 |
77 | {{- end -}}
--------------------------------------------------------------------------------
/layouts/_partials/features/comments/artalk.html:
--------------------------------------------------------------------------------
1 | {{/* Artalk 评论系统组件
2 |
3 | 自托管的评论系统,功能丰富且可定制
4 |
5 | @context {page} . 当前文章页面对象
6 | @param {string} id 评论容器的唯一 ID
7 | */}}
8 |
9 | {{ $id := .id | default "artalk-comments" }}
10 | {{ $config := .Site.Params.comments.artalk }}
11 |
12 | {{ if $config.server }}
13 |
14 | {{/* 加载 Artalk CSS */}}
15 |
18 |
19 |
65 |
66 | {{ else }}
67 |
68 |
70 | {{ partial "features/icon.html" (dict "name" "server" "size" "lg" "ariaLabel" "") }}
71 |
72 |
73 | {{ i18n "comments.artalk_not_configured" | default "Artalk 未配置" }}
74 |
75 |
76 | {{ i18n "comments.artalk_config_desc" | default "请在站点配置中设置 Artalk 服务器地址和站点名称" }}
77 |
78 |
79 | {{ end }}
80 |
--------------------------------------------------------------------------------
/layouts/_partials/ui/dropdown-button.html:
--------------------------------------------------------------------------------
1 | {{/*
2 | 统一的下拉菜单按钮组件
3 |
4 | 参数说明:
5 | - .type: 下拉菜单类型 (language|theme|color-scheme)
6 | - .icon: 按钮图标名称
7 | - .ariaLabel: 按钮的aria-label
8 | - .buttonId: 按钮ID (可选,主要用于桌面端)
9 | - .dropdownId: 下拉菜单ID (可选,主要用于桌面端)
10 | - .menuWidth: 菜单宽度类名 (如 w-40, w-44)
11 | - .showCondition: 显示条件 (如 site.Params.showLanguageSwitch)
12 | - .content: 下拉菜单内容 (通过 block 传入)
13 | */}}
14 |
15 | {{- $type := .type -}}
16 | {{- $icon := .icon -}}
17 | {{- $ariaLabel := .ariaLabel -}}
18 | {{- $buttonId := .buttonId | default "" -}}
19 | {{- $dropdownId := .dropdownId | default "" -}}
20 | {{- $menuWidth := .menuWidth | default "w-40" -}}
21 | {{- $showCondition := .showCondition | default true -}}
22 |
23 | {{- if $showCondition -}}
24 |
25 |
26 |
47 |
48 |
49 |
57 |
58 | {{- /* 这里通过 block 机制传入具体的菜单内容 */ -}}
59 | {{- .content -}}
60 |
61 |
62 | {{- end -}}
63 |
--------------------------------------------------------------------------------
/layouts/_partials/content/link.html:
--------------------------------------------------------------------------------
1 | {{- $link := .link -}}
2 | {{- $title := .title -}}
3 | {{- $description := .description -}}
4 | {{- $url := .url -}}
5 | {{- $icon := .icon -}}
6 |
7 |
8 | {{- if and (not $title) $link (reflect.IsMap $link) -}}
9 | {{- $title = $link.title -}}
10 | {{- end -}}
11 |
12 | {{- if and (not $description) $link (reflect.IsMap $link) -}}
13 | {{- $description = $link.description -}}
14 | {{- end -}}
15 |
16 | {{- if and (not $url) $link (reflect.IsMap $link) -}}
17 | {{- $url = $link.url -}}
18 | {{- end -}}
19 |
20 | {{- if and (not $icon) $link (reflect.IsMap $link) -}}
21 | {{- $icon = $link.icon -}}
22 | {{- end -}}
23 |
24 |
--------------------------------------------------------------------------------
/i18n/ar.yaml:
--------------------------------------------------------------------------------
1 | # ملف اللغة العربية
2 | # التنقل
3 | nav:
4 | menu: "القائمة"
5 | home: "الرئيسية"
6 | posts: "المقالات"
7 | tags: "الوسوم"
8 | categories: "التصنيفات"
9 | about: "حول"
10 | contact: "اتصل بنا"
11 | archive: "الأرشيف"
12 | archives: "الأرشيف"
13 | search: "بحث"
14 | breadcrumb: "شريط التنقل"
15 | pagination: "الصفحات"
16 | prev: "السابق"
17 | next: "التالي"
18 | prev_page: "الصفحة السابقة"
19 | next_page: "الصفحة التالية"
20 | page_info: "الصفحة {{ .current }} من {{ .total }}"
21 | total_pages: "{{ .count }} صفحات"
22 | back_home: "العودة للرئيسية"
23 | post_navigation: "تنقل المقالات"
24 |
25 | # السمة
26 | theme:
27 | toggle: "تبديل السمة"
28 | light: "فاتح"
29 | dark: "داكن"
30 | system: "النظام"
31 | auto: "تلقائي"
32 |
33 | # التذييل
34 | footer:
35 | copyright: "حقوق النشر"
36 | all_rights_reserved: "جميع الحقوق محفوظة"
37 | about_us: "من نحن"
38 | contact_us: "اتصل بنا"
39 | privacy_policy: "سياسة الخصوصية"
40 | terms_of_service: "شروط الخدمة"
41 | rss_feed: "تغذية RSS"
42 |
43 | # الصفحة الرئيسية
44 | home:
45 | recent_posts: "أحدث المقالات"
46 | showing_posts: "عرض الأحدث"
47 | posts: "مقالات"
48 | view_all_posts: "عرض جميع المقالات"
49 |
50 | # المقالات
51 | post:
52 | read_more: "اقرأ المزيد"
53 | published_on: "نُشر في"
54 | updated_on: "تم التحديث في"
55 | tags: "الوسوم"
56 | categories: "التصنيفات"
57 | share: "مشاركة"
58 | previous: "السابق"
59 | next: "التالي"
60 | related_posts: "مقالات ذات صلة"
61 | reading_time: "وقت القراءة"
62 | no_posts: "لا توجد مقالات"
63 | no_posts_desc: "لم يتم نشر أي مقالات بعد. يرجى العودة لاحقاً."
64 | list_desc: "جميع المقالات المنشورة، مرتبة من الأحدث إلى الأقدم."
65 | total_posts: "{{ .count }} مقالات"
66 | author: "الكاتب"
67 | words: "كلمات"
68 | words_count: "عدد الكلمات"
69 | no_previous: "لا يوجد مقال سابق"
70 | no_next: "لا يوجد مقال تالي"
71 | no_previous_desc: "هذا أقدم مقال"
72 | no_next_desc: "هذا أحدث مقال"
73 | view_more_posts: "عرض المزيد من المقالات"
74 | reading_time_unit: "دقيقة"
75 |
76 | # الترقيم
77 | pagination:
78 | previous: "السابق"
79 | next: "التالي"
80 | page: "صفحة"
81 | of: "من"
82 | pages: "صفحات"
83 |
84 | # البحث
85 | search:
86 | placeholder: "ابحث في المقالات..."
87 | clear: "مسح"
88 | close: "إغلاق"
89 | loading: "جاري البحث..."
90 | empty_title: "ابدأ البحث"
91 | empty_description: "أدخل كلمات البحث"
92 | no_results_title: "لا توجد نتائج"
93 | no_results_description: "جرب كلمات بحث مختلفة"
94 | results_count: "تم العثور على %d نتيجة"
95 | match_score: "درجة التطابق"
96 | hint_navigate: "تنقل"
97 | hint_select: "اختيار"
98 | hint_close: "إغلاق"
99 | hint_shortcut: "اختصار"
100 |
101 | # الروابط
102 | links: "روابط"
103 |
--------------------------------------------------------------------------------
/layouts/_partials/features/icon.html:
--------------------------------------------------------------------------------
1 | {{/*
2 | Icon partial template
3 |
4 | Usage:
5 | {{ partial "features/icon.html" (dict "name" "sun" "class" "h-5 w-5" "id" "sun-icon") }}
6 |
7 | Parameters:
8 | - name: Icon name (required) - corresponds to SVG file in assets/icons/
9 | - class: CSS classes to apply to the SVG (optional)
10 | - id: HTML id attribute (optional)
11 | - size: Predefined size (optional) - "xs", "sm", "md", "lg", "xl", "2xl"
12 | - ariaLabel: Accessibility label (optional)
13 | - hidden: Whether to add aria-hidden="true" (optional, defaults to false)
14 | */}}
15 |
16 | {{- $name := .name -}}
17 | {{- $class := .class | default "" -}}
18 | {{- $id := .id | default "" -}}
19 | {{- $size := .size | default "" -}}
20 | {{- $ariaLabel := .ariaLabel | default "" -}}
21 | {{- $hidden := .hidden | default false -}}
22 |
23 | {{/* Size presets */}}
24 | {{- $sizeClasses := dict
25 | "xs" "h-3 w-3"
26 | "sm" "h-4 w-4"
27 | "md" "h-5 w-5"
28 | "lg" "h-6 w-6"
29 | "xl" "h-8 w-8"
30 | "2xl" "h-10 w-10"
31 | -}}
32 |
33 | {{/* Build CSS classes */}}
34 | {{- $finalClass := $class -}}
35 | {{- if $size -}}
36 | {{- $sizeClass := index $sizeClasses $size -}}
37 | {{- if $sizeClass -}}
38 | {{- $finalClass = printf "%s %s" $sizeClass $class -}}
39 | {{- end -}}
40 | {{- end -}}
41 |
42 | {{/* Get the SVG file */}}
43 | {{- $iconPath := printf "icons/%s.svg" $name -}}
44 | {{- $icon := resources.Get $iconPath -}}
45 |
46 | {{- if $icon -}}
47 | {{/* Get the SVG content and process it */}}
48 | {{- $content := $icon.Content -}}
49 | {{- $content = replaceRE `` "" $content -}}
51 |
52 | {{/* Build the final SVG with our attributes */}}
53 |
63 | {{- else -}}
64 | {{/* Fallback if icon not found */}}
65 |
75 | {{/* Log warning in development */}}
76 | {{- if hugo.IsDevelopment -}}
77 | {{- warnf "Icon '%s' not found at %s" $name $iconPath -}}
78 | {{- end -}}
79 | {{- end -}}
80 |
--------------------------------------------------------------------------------
/layouts/_partials/features/comments.html:
--------------------------------------------------------------------------------
1 | {{/* 评论系统组件
2 |
3 | 支持多种评论系统:
4 | - Giscus (基于 GitHub Discussions)
5 | - Disqus (传统评论系统)
6 | - Utterances (基于 GitHub Issues)
7 | - Waline (简洁评论系统)
8 | - Artalk (自托管评论系统)
9 | - Twikoo (简洁评论系统)
10 |
11 | @context {page} . 当前文章页面对象
12 | */}}
13 |
14 | {{- $commentsConfig := .Site.Params.comments -}}
15 | {{- $commentSystem := $commentsConfig.system -}}
16 |
17 | {{- if and $commentsConfig.enabled (not .Params.comments_disabled) -}}
18 |
63 | {{- end -}}
64 |
--------------------------------------------------------------------------------
/layouts/_partials/content/post-license.html:
--------------------------------------------------------------------------------
1 | {{/* 文章许可证信息组件
2 |
3 | 显示文章的版权和许可证信息
4 |
5 | @context {page} . 当前文章页面对象
6 | */}}
7 |
8 | {{/* 构建许可证配置 */}}
9 | {{ $license := dict }}
10 |
11 | {{/* 设置默认值 */}}
12 | {{ $defaults := dict
13 | "show" true
14 | "author" (.Site.Params.author.name | default "")
15 | "name" "CC BY-NC-SA 4.0"
16 | "description" "本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可。"
17 | "url" "https://creativecommons.org/licenses/by-nc-sa/4.0/"
18 | "displayName" "知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议"
19 | }}
20 |
21 |
22 | {{ $license = $defaults }}
23 | {{ with .Site.Params.post.license }}
24 | {{ $license = merge $license . }}
25 | {{ end }}
26 | {{ with .Params.license }}
27 | {{ $license = merge $license . }}
28 | {{ end }}
29 |
30 |
31 | {{ if $license.show }}
32 |
33 |
34 |
35 |
37 | {{ partial "features/icon.html" (dict "name" "license" "size" "lg" "ariaLabel" "许可证") }}
38 |
39 |
40 |
41 |
42 |
43 | {{ i18n "license.title" | default "版权声明" }}
44 |
45 |
46 |
47 |
48 | {{ with $license.author }}
49 |
50 | {{ i18n "license.author" | default "作者" }}:
51 | {{ . }}
52 |
53 | {{ end }}
54 |
55 |
56 |
57 | {{ i18n "license.link" | default "链接" }}:
58 |
61 | {{ .Permalink }}
62 |
63 |
64 |
65 |
66 |
67 | {{ i18n "license.type" | default "许可证" }}:
68 | {{ with $license.url }}
69 |
74 | {{ $license.displayName }}
75 |
76 | {{ else }}
77 | {{ $license.displayName }}
78 | {{ end }}
79 |
80 |
81 |
82 | {{ with $license.description }}
83 |
84 | {{ . }}
85 |
86 | {{ end }}
87 |
88 |
89 |
90 |
91 | {{ end }}
--------------------------------------------------------------------------------
/layouts/_shortcodes/link.html:
--------------------------------------------------------------------------------
1 | {{- $title := (.Get "title") | default (.Get "name") -}}
2 | {{- $description := .Get "description" -}}
3 | {{- $url := .Get "url" -}}
4 | {{- $icon := .Get "icon" -}}
5 | {{- $id := .Get "id" -}}
6 | {{- $ref := .Get "ref" -}}
7 | {{- $category := .Get "category" -}}
8 | {{- $group := .Get "group" -}}
9 |
10 | {{- /* 所有情况都使用统一的容器 */ -}}
11 |
12 |
13 | {{- /* 方式1: 直接传参 */ -}}
14 | {{- if and $title $url -}}
15 | {{ partial "content/link.html" (dict
16 | "title" $title
17 | "description" ($description | default "")
18 | "url" $url
19 | "icon" ($icon | default "")
20 | ) }}
21 |
22 | {{- /* 方式2: 使用ID引用数据 */ -}}
23 | {{- else if or $id $ref -}}
24 | {{- $linkId := $id | default $ref -}}
25 | {{- $found := false -}}
26 |
27 | {{- /* 检查数据文件是否存在 */ -}}
28 | {{- if site.Data.links -}}
29 | {{- range $catName, $linkList := site.Data.links -}}
30 | {{- if $linkList -}}
31 | {{- range $linkData := $linkList -}}
32 | {{- if and $linkData $linkData.id (eq $linkData.id $linkId) -}}
33 | {{ partial "content/link.html" (dict
34 | "title" ($linkData.title | default "")
35 | "description" ($linkData.description | default "")
36 | "url" ($linkData.url | default "")
37 | "icon" ($linkData.icon | default "")
38 | ) }}
39 | {{- $found = true -}}
40 | {{- break -}}
41 | {{- end -}}
42 | {{- end -}}
43 | {{- if $found -}}{{- break -}}{{- end -}}
44 | {{- end -}}
45 | {{- end -}}
46 | {{- end -}}
47 |
48 | {{- if not $found -}}
49 |
50 |
⚠️ 未找到 ID 为 "{{ $linkId }}" 的链接
51 |
52 | {{- end -}}
53 |
54 | {{- /* 方式3: 批量引用 */ -}}
55 | {{- else if or $category $group -}}
56 | {{- $categoryName := $category | default $group -}}
57 | {{- $links := "" -}}
58 | {{- if site.Data.links -}}
59 | {{- $links = index site.Data.links $categoryName -}}
60 | {{- end -}}
61 |
62 | {{- if $links -}}
63 | {{- range $linkData := $links -}}
64 | {{- if $linkData -}}
65 | {{ partial "content/link.html" (dict
66 | "title" ($linkData.title | default "")
67 | "description" ($linkData.description | default "")
68 | "url" ($linkData.url | default "")
69 | "icon" ($linkData.icon | default "")
70 | ) }}
71 | {{- end -}}
72 | {{- end -}}
73 | {{- else -}}
74 |
75 |
⚠️ 未找到分类 "{{ $categoryName }}" 的链接
76 |
77 | {{- end -}}
78 |
79 | {{- /* 错误处理 */ -}}
80 | {{- else -}}
81 |
82 |
⚠️ linkcard 短代码使用错误
83 |
请使用以下方式之一:
84 |
85 | - 直接传参: title 和 url 参数
86 | - 引用数据: id 或 ref 参数
87 | - 批量引用: category 或 group 参数
88 |
89 |
90 | {{- end -}}
91 |
92 |
--------------------------------------------------------------------------------
/layouts/posts/list.html:
--------------------------------------------------------------------------------
1 | {{ define "main" }}
2 |
3 |
4 | {{ partial "navigation/breadcrumb.html" . }}
5 |
6 |
7 |
8 |
9 |
10 | {{ i18n "nav.posts" | default "文章" }}
11 |
12 |
13 | {{ if .Content }}
14 |
15 | {{ .Content }}
16 |
17 | {{ else }}
18 |
19 | {{ i18n "post.list_desc" | default "这里是所有已发布的文章,按时间倒序排列。" }}
20 |
21 | {{ end }}
22 |
23 |
24 |
25 |
26 |
27 | {{ partial "features/icon.html" (dict "name" "folder" "size" "sm" "ariaLabel" "") }}
28 | {{ i18n "post.total_posts" (dict "count" .Paginator.TotalNumberOfElements) | default (printf "共 %d 篇文章" .Paginator.TotalNumberOfElements) }}
31 |
32 | {{ if gt .Paginator.TotalPages 1 }}
33 |
34 | {{ partial "features/icon.html" (dict "name" "layers" "size" "sm" "ariaLabel" "") }}
35 | {{ i18n "nav.total_pages" (dict "count" .Paginator.TotalPages) | default (printf "共 %d 页" .Paginator.TotalPages) }}
38 |
39 | {{ end }}
40 |
41 |
42 |
43 |
44 | {{ $posts := .Paginator.Pages }}
45 | {{ if $posts }}
46 | {{ partial "content/post-list.html" (dict "posts" $posts) }}
47 | {{ else }}
48 |
49 |
50 |
52 | {{ partial "features/icon.html" (dict "name" "folder" "size" "xl" "ariaLabel" "") }}
53 |
54 |
55 | {{ i18n "post.no_posts" | default "暂无文章" }}
56 |
57 |
58 | {{ i18n "post.no_posts_desc" | default "还没有发布任何文章,请稍后再来查看。" }}
59 |
60 |
63 | {{ partial "features/icon.html" (dict "name" "home" "size" "sm" "ariaLabel" "") }}
64 | {{ i18n "nav.back_home" | default "返回首页" }}
65 |
66 |
67 | {{ end }}
68 |
69 |
70 |
71 | {{ partial "navigation/pagination.html" . }}
72 |
73 |
74 | {{ end }}
75 |
--------------------------------------------------------------------------------
/exampleSite/content/posts/alert-test.zh-cn.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "GitHub 风格提示框测试"
3 | date: 2025-06-01T10:00:00+08:00
4 | slug: test-alert
5 | draft: false
6 | description: "测试 GitHub 风格提示框和折叠功能"
7 | tags: ["测试", "提示框", "markdown"]
8 | categories: ["Github"]
9 | ---
10 |
11 | # GitHub 风格提示框测试
12 |
13 | 本文用于测试新的 GitHub 风格提示框功能和折叠功能。
14 |
15 | ## 提示框语法
16 |
17 | ### 注意提示框
18 |
19 | > [!NOTE]
20 | > 这是一个注意提示框。用于显示用户应该注意的有用信息,即使在快速浏览内容时也应该注意。
21 |
22 | ### 提示提示框
23 |
24 | > [!TIP]
25 | > 这是一个提示提示框。提供有助于更好或更轻松地完成任务的建议。
26 |
27 | ### 重要提示框
28 |
29 | > [!IMPORTANT]
30 | > 这是一个重要提示框。显示用户成功完成任务所需的关键信息。
31 |
32 | ### 警告提示框
33 |
34 | > [!WARNING]
35 | > 这是一个警告提示框。由于潜在风险,需要用户立即注意的关键内容。
36 |
37 | ### 注意提示框
38 |
39 | > [!CAUTION]
40 | > 这是一个注意提示框。建议采取行动以避免负面后果。
41 |
42 | ## 折叠功能
43 |
44 | ### 可折叠的注意提示框
45 |
46 | > [!NOTE]+ 可折叠的注意事项
47 | > 这是一个可折叠的注意提示框。点击标题可以展开或折叠内容。
48 | >
49 | > 这里可以包含更多详细信息,当用户需要时可以展开查看。
50 |
51 | ### 可折叠的提示提示框
52 |
53 | > [!TIP]+ 高级使用技巧
54 | > 这个折叠的提示框包含高级使用技巧:
55 | >
56 | > 1. 首先做这个
57 | > 2. 然后做那个
58 | > 3. 最后完成这个步骤
59 | >
60 | > 记住要按顺序执行这些步骤。
61 |
62 | ### 可折叠的重要提示框
63 |
64 | > [!IMPORTANT]+ 重要配置信息
65 | > 这些配置设置对系统正常运行至关重要:
66 | >
67 | > ```yaml
68 | > server:
69 | > port: 8080
70 | > host: localhost
71 | > database:
72 | > url: mongodb://localhost:27017
73 | > name: myapp
74 | > ```
75 | >
76 | > 请确保所有设置都正确配置。
77 |
78 | ### 可折叠的警告提示框
79 |
80 | > [!WARNING]+ 安全警告
81 | > 在继续之前,请注意以下安全考虑:
82 | >
83 | > - 确保所有密码都是强密码
84 | > - 启用双因素认证
85 | > - 定期更新系统
86 | > - 不要在公共网络上执行敏感操作
87 |
88 | ### 可折叠的注意提示框
89 |
90 | > [!CAUTION]+ 复杂内容示例
91 | > 这个可折叠框包含复杂的 Markdown 内容:
92 | >
93 | > #### 子标题
94 | >
95 | > 这是一个包含[链接](https://example.com)和其他格式的段落。
96 | >
97 | > ```javascript
98 | > // 代码块示例
99 | > function hello() {
100 | > console.log("你好,世界!");
101 | > }
102 | > ```
103 | >
104 | > | 表格 | 示例 |
105 | > |------|------|
106 | > | 行1 | 数据1 |
107 | > | 行2 | 数据2 |
108 |
109 | ## 普通引用块
110 |
111 | 这是一个普通的引用块,不是提示框:
112 |
113 | > 这是一个标准的引用块。它不会被渲染为提示框,而是使用标准的引用块样式。
114 | >
115 | > 支持多行内容和**格式化文本**。
116 |
117 | ## 多语言支持
118 |
119 | 提示框支持多种语言,标题会自动以当前语言显示:
120 |
121 | > [!NOTE]
122 | > 在中文环境中,这个标题会显示为"注意"。
123 |
124 | > [!TIP]
125 | > 在中文环境中,这个标题会显示为"提示"。
126 |
127 | ## 嵌套内容测试
128 |
129 | > [!WARNING]+ 嵌套内容测试
130 | > 这个提示框包含嵌套内容:
131 | >
132 | > > 这是一个嵌套的引用块
133 | >
134 | > - 列表项
135 | > - 嵌套列表项
136 | > - 另一个嵌套项
137 | >
138 | > 1. 有序列表
139 | > 1. 嵌套有序列表
140 | > 2. 另一个嵌套项
141 |
142 | ## 使用场景示例
143 |
144 | ### 文档说明
145 |
146 | > [!NOTE]
147 | > 本功能从版本 2.0 开始可用。如果您使用的是较早版本,请先升级。
148 |
149 | ### 最佳实践
150 |
151 | > [!TIP]+ 性能优化建议
152 | > 为了获得最佳性能,建议:
153 | >
154 | > - 使用 CDN 加速静态资源
155 | > - 启用 gzip 压缩
156 | > - 优化图片大小
157 | > - 使用浏览器缓存
158 |
159 | ### 重要配置
160 |
161 | > [!IMPORTANT]
162 | > 修改配置文件后,必须重启服务才能生效。
163 |
164 | ### 安全提醒
165 |
166 | > [!WARNING]
167 | > 请勿在生产环境中使用默认密码。
168 |
169 | ### 破坏性操作
170 |
171 | > [!CAUTION]
172 | > 此操作将永久删除所有数据,且无法恢复。请确保已备份重要数据。
173 |
174 | 这些提示框可以帮助用户更好地理解内容的重要性和上下文,提升文档的可读性和用户体验。
175 |
--------------------------------------------------------------------------------
/layouts/_partials/features/comments/disqus.html:
--------------------------------------------------------------------------------
1 | {{/* Disqus 评论系统组件
2 |
3 | 传统的评论系统,支持多种功能
4 |
5 | @context {page} . 当前文章页面对象
6 | @param {string} id 评论容器的唯一 ID
7 | */}}
8 |
9 | {{ $id := .id | default "disqus-comments" }}
10 | {{ $config := .Site.Params.comments.disqus }}
11 |
12 | {{ if $config.shortname }}
13 |
67 | {{ else }}
68 |
69 |
71 | {{ partial "features/icon.html" (dict "name" "message-circle" "size" "lg" "ariaLabel" "") }}
72 |
73 |
74 | {{ i18n "comments.disqus_not_configured" | default "Disqus 未配置" }}
75 |
76 |
77 | {{ i18n "comments.disqus_config_desc" | default "请在站点配置中设置 Disqus shortname" }}
78 |
79 |
80 | {{ end }}
81 |
--------------------------------------------------------------------------------
/layouts/_partials/ui/toc-card.html:
--------------------------------------------------------------------------------
1 | {{/* 目录卡片组件
2 |
3 | 显示文章目录,支持当前阅读位置高亮和点击跳转
4 |
5 | @context {page} . 当前文章页面对象
6 | */}}
7 |
8 |
9 |
10 |
16 |
17 |
18 |
24 |
26 |
27 |
29 |
30 | {{ partial "features/icon.html" (dict "name" "list" "size" "md" "ariaLabel" "") }}
31 |
32 | {{ i18n "toc.title" | default "目录" }}
33 |
34 |
35 |
36 |
37 |
44 |
45 |
46 |
47 |
48 |
70 |
71 |
72 |
73 |
74 |
75 | {{ i18n "toc.tip" | default "点击标题快速跳转" }}
76 |
77 |
78 |
79 |
80 |
--------------------------------------------------------------------------------
/layouts/_partials/features/mermaid.html:
--------------------------------------------------------------------------------
1 | {{/* Mermaid 图表支持
2 | 基于配置控制是否加载 Mermaid 库
3 | */}}
4 |
5 | {{/* 获取全局配置 */}}
6 | {{- $globalMermaid := site.Params.mermaid -}}
7 | {{- $globalEnabled := false -}}
8 |
9 | {{- if $globalMermaid -}}
10 | {{- if eq (printf "%T" $globalMermaid) "bool" -}}
11 | {{- $globalEnabled = $globalMermaid -}}
12 | {{- else -}}
13 | {{- $globalEnabled = $globalMermaid.enabled | default false -}}
14 | {{- end -}}
15 | {{- end -}}
16 |
17 | {{/* 获取页面级配置 */}}
18 | {{- $pageMermaid := .Params.mermaid -}}
19 | {{- $pageEnabled := false -}}
20 |
21 | {{- if $pageMermaid -}}
22 | {{- if eq (printf "%T" $pageMermaid) "bool" -}}
23 | {{- $pageEnabled = $pageMermaid -}}
24 | {{- else -}}
25 | {{- $pageEnabled = $pageMermaid.enabled | default false -}}
26 | {{- end -}}
27 | {{- end -}}
28 |
29 | {{/* 检查是否需要加载 Mermaid */}}
30 | {{- $shouldLoad := false -}}
31 | {{- if $globalEnabled -}}
32 | {{- $shouldLoad = true -}}
33 | {{- else if $pageEnabled -}}
34 | {{- $shouldLoad = true -}}
35 | {{- end -}}
36 |
37 | {{/* 如果页面包含 Mermaid 图表且配置允许,则加载库 */}}
38 | {{- if and $shouldLoad (.Store.Get "hasMermaid") -}}
39 |
40 |
47 |
103 | {{- end -}}
104 |
--------------------------------------------------------------------------------
/layouts/list.html:
--------------------------------------------------------------------------------
1 | {{ define "main" }}
2 |
3 |
4 | {{ partial "navigation/breadcrumb.html" . }}
5 |
6 |
7 |
8 |
9 |
10 | {{ if eq .Section "posts" }}
11 | {{ i18n "nav.posts" | default "文章" }}
12 | {{ else if eq .Section "archives" }}
13 | {{ i18n "nav.archives" | default "归档" }}
14 | {{ else if eq .Section "tags" }}
15 | {{ i18n "nav.tags" | default "标签" }}
16 | {{ else if eq .Section "categories" }}
17 | {{ i18n "nav.categories" | default "分类" }}
18 | {{ else }}
19 | {{ .Title }}
20 | {{ end }}
21 |
22 |
23 | {{ if .Content }}
24 |
25 | {{ .Content }}
26 |
27 | {{ else if eq .Section "posts" }}
28 |
29 | {{ i18n "post.list_desc" | default "这里是所有已发布的文章,按时间倒序排列。" }}
30 |
31 | {{ end }}
32 |
33 |
34 |
35 | {{ if eq .Section "posts" }}
36 |
37 |
38 | {{ partial "features/icon.html" (dict "name" "folder" "size" "sm" "ariaLabel" "") }}
39 | {{ i18n "post.total_posts" (dict "count" .Paginator.TotalNumberOfElements) | default (printf "共 %d 篇文章" .Paginator.TotalNumberOfElements) }}
42 |
43 | {{ if gt .Paginator.TotalPages 1 }}
44 |
45 | {{ partial "features/icon.html" (dict "name" "layers" "size" "sm" "ariaLabel" "") }}
46 | {{ i18n "nav.total_pages" (dict "count" .Paginator.TotalPages) | default (printf "共 %d 页" .Paginator.TotalPages) }}
49 |
50 | {{ end }}
51 |
52 | {{ end }}
53 |
54 |
55 |
56 | {{ $posts := .Paginator.Pages }}
57 | {{ if $posts }}
58 | {{ partial "content/post-list.html" (dict "posts" $posts) }}
59 | {{ else }}
60 |
61 |
62 |
64 | {{ partial "features/icon.html" (dict "name" "folder" "size" "xl" "ariaLabel" "") }}
65 |
66 |
67 | {{ i18n "post.no_posts" | default "暂无文章" }}
68 |
69 |
70 | {{ i18n "post.no_posts_desc" | default "还没有发布任何文章,请稍后再来查看。" }}
71 |
72 |
75 | {{ partial "features/icon.html" (dict "name" "home" "size" "sm" "ariaLabel" "") }}
76 | {{ i18n "nav.back_home" | default "返回首页" }}
77 |
78 |
79 | {{ end }}
80 |
81 |
82 |
83 | {{ partial "navigation/pagination.html" . }}
84 |
85 |
86 | {{ end }}
87 |
--------------------------------------------------------------------------------
/static/js/gumshoe.polyfills.min.js:
--------------------------------------------------------------------------------
1 | /*! gumshoejs v5.1.1 | (c) 2019 Chris Ferdinandi | MIT License | http://github.com/cferdinandi/gumshoe */
2 | Element.prototype.closest||(Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),Element.prototype.closest=function(t){var e=this;if(!document.documentElement.contains(this))return null;do{if(e.matches(t))return e;e=e.parentElement}while(null!==e);return null}),(function(){if("function"==typeof window.CustomEvent)return!1;function t(t,e){e=e||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),n}t.prototype=window.Event.prototype,window.CustomEvent=t})(),(function(t,e){"function"==typeof define&&define.amd?define([],(function(){return e(t)})):"object"==typeof exports?module.exports=e(t):t.Gumshoe=e(t)})("undefined"!=typeof global?global:"undefined"!=typeof window?window:this,(function(t){"use strict";var e={navClass:"active",contentClass:"active",nested:!1,nestedClass:"active",offset:0,reflow:!1,events:!0},n=function(t,e,n){if(n.settings.events){var o=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n});e.dispatchEvent(o)}},o=function(t){var e=0;if(t.offsetParent)for(;t;)e+=t.offsetTop,t=t.offsetParent;return e>=0?e:0},s=function(t){t&&t.sort((function(t,e){return o(t.content)=Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},i=function(t,e){var n=t[t.length-1];if(function(t,e){return!(!r()||!c(t.content,e,!0))}(n,e))return n;for(var o=t.length-1;o>=0;o--)if(c(t[o].content,e))return t[o]},l=function(t,e){if(e.nested){var n=t.parentNode.closest("li");n&&(n.classList.remove(e.nestedClass),l(n,e))}},a=function(t,e){if(t){var o=t.nav.closest("li");o&&(o.classList.remove(e.navClass),t.content.classList.remove(e.contentClass),l(o,e),n("gumshoeDeactivate",o,{link:t.nav,content:t.content,settings:e}))}},u=function(t,e){if(e.nested){var n=t.parentNode.closest("li");n&&(n.classList.add(e.nestedClass),u(n,e))}};return function(o,c){var r,l,f,d,m,v={};v.setup=function(){r=document.querySelectorAll(o),l=[],Array.prototype.forEach.call(r,(function(t){var e=document.getElementById(decodeURIComponent(t.hash.substr(1)));e&&l.push({nav:t,content:e})})),s(l)},v.detect=function(){var t=i(l,m);t?f&&t.content===f.content||(a(f,m),(function(t,e){if(t){var o=t.nav.closest("li");o&&(o.classList.add(e.navClass),t.content.classList.add(e.contentClass),u(o,e),n("gumshoeActivate",o,{link:t.nav,content:t.content,settings:e}))}})(t,m),f=t):f&&(a(f,m),f=null)};var p=function(e){d&&t.cancelAnimationFrame(d),d=t.requestAnimationFrame(v.detect)},h=function(e){d&&t.cancelAnimationFrame(d),d=t.requestAnimationFrame((function(){s(l),v.detect()}))};v.destroy=function(){f&&a(f,m),t.removeEventListener("scroll",p,!1),m.reflow&&t.removeEventListener("resize",h,!1),l=null,r=null,f=null,d=null,m=null};return m=(function(){var t={};return Array.prototype.forEach.call(arguments,(function(e){for(var n in e){if(!e.hasOwnProperty(n))return;t[n]=e[n]}})),t})(e,c||{}),v.setup(),v.detect(),t.addEventListener("scroll",p,!1),m.reflow&&t.addEventListener("resize",h,!1),v}}));
--------------------------------------------------------------------------------
/layouts/_partials/ui/language-switcher.html:
--------------------------------------------------------------------------------
1 | {{- if and hugo.IsMultilingual (site.Params.showLanguageSwitch | default true) -}}
2 | {{- $currentLang := .Language.Lang -}}
3 | {{- $currentPage := . -}}
4 | {{- $languageSwitchMode := site.Params.languageSwitchMode | default "dropdown" -}}
5 | {{/* 点击切换模式 */}}
6 | {{- if eq $languageSwitchMode "cycle" -}}
7 | {{- $languages := slice -}}
8 | {{- range site.Languages -}}
9 | {{- $languages = $languages | append . -}}
10 | {{- end -}}
11 |
12 |
13 | {{- $currentIndex := 0 -}}
14 | {{- range $index, $lang := $languages -}}
15 | {{- if eq $lang.Lang $currentLang -}}
16 | {{- $currentIndex = $index -}}
17 | {{- end -}}
18 | {{- end -}}
19 |
20 |
21 | {{- $nextIndex := mod (add $currentIndex 1) (len $languages) -}}
22 | {{- $nextLang := index $languages $nextIndex -}}
23 |
24 | {{- $targetURL := "/" -}}
25 | {{- if $currentPage.IsTranslated -}}
26 | {{- range $currentPage.Translations -}}
27 | {{- if eq .Language.Lang $nextLang.Lang -}}
28 | {{- $targetURL = .RelPermalink -}}
29 | {{- end -}}
30 | {{- end -}}
31 | {{- if eq $targetURL "/" -}}
32 | {{- $targetURL = printf "/%s/" $nextLang.Lang -}}
33 | {{- end -}}
34 | {{- else -}}
35 | {{- $targetURL = printf "/%s/" $nextLang.Lang -}}
36 | {{- end -}}
37 |
38 |
47 | {{- else -}}
48 | {{- /* 下拉菜单模式 */ -}}
49 | {{- $languageMenuContent := "" -}}
50 | {{- range site.Languages -}}
51 | {{- $lang := .Lang -}}
52 | {{- $langName := .LanguageName -}}
53 | {{- $isCurrent := eq $lang $currentLang -}}
54 |
55 | {{- /* 获取当前页面在目标语言下的URL */ -}}
56 | {{- $targetURL := "/" -}}
57 | {{- if $currentPage.IsTranslated -}}
58 | {{- range $currentPage.Translations -}}
59 | {{- if eq .Language.Lang $lang -}}
60 | {{- $targetURL = .RelPermalink -}}
61 | {{- end -}}
62 | {{- end -}}
63 | {{- if eq $targetURL "/" -}}
64 | {{- $targetURL = printf "/%s/" $lang -}}
65 | {{- end -}}
66 | {{- else -}}
67 | {{- $targetURL = printf "/%s/" $lang -}}
68 | {{- end -}}
69 |
70 | {{- $languageMenuContent = printf "%s%s" $languageMenuContent $targetURL (cond $isCurrent " aria-current=\"true\"" "") $langName -}}
71 | {{- end -}}
72 |
73 | {{- /* 使用统一的下拉菜单组件 */ -}}
74 | {{- partial "ui/dropdown-button.html" (dict
75 | "type" "language"
76 | "icon" "language"
77 | "ariaLabel" (i18n "language.toggle")
78 | "buttonId" "language-toggle"
79 | "dropdownId" "language-dropdown"
80 | "menuWidth" "w-40"
81 | "showCondition" true
82 | "content" (safeHTML $languageMenuContent)
83 | ) -}}
84 | {{- end -}}
85 |
86 | {{- end -}}
87 |
--------------------------------------------------------------------------------
/layouts/term.html:
--------------------------------------------------------------------------------
1 | {{ define "main" }}
2 |
3 | {{ partial "navigation/breadcrumb.html" . }}
4 |
5 |
6 |
7 |
8 |
9 | {{ if eq .Data.Singular "tag" }}
10 | {{ partial "features/icon.html" (dict "name" "tag" "size" "lg" "ariaLabel" "") }}
11 | {{ else if eq .Data.Singular "category" }}
12 | {{ partial "features/icon.html" (dict "name" "folder" "size" "lg" "ariaLabel" "") }}
13 | {{ else }}
14 | {{ partial "features/icon.html" (dict "name" "bookmark" "size" "lg" "ariaLabel" "") }}
15 | {{ end }}
16 |
17 | {{ .Title }}
18 |
19 |
20 |
21 | {{ if .Content }}
22 |
23 | {{ .Content }}
24 |
25 | {{ else }}
26 |
27 | {{ if eq .Data.Singular "tag" }}
28 | {{ i18n "term.tag_desc" (dict "tag" .Title) | default (printf "标签 \"%s\" 下的所有文章" .Title) }}
29 | {{ else if eq .Data.Singular "category" }}
30 | {{ i18n "term.category_desc" (dict "category" .Title) | default (printf "分类 \"%s\" 下的所有文章" .Title) }}
31 | {{ else }}
32 | {{ i18n "term.desc" (dict "term" .Title) | default (printf "\"%s\" 下的所有文章" .Title) }}
33 | {{ end }}
34 |
35 | {{ end }}
36 |
37 |
38 |
39 |
40 |
41 | {{ partial "features/icon.html" (dict "name" "file-text" "size" "sm" "ariaLabel" "") }}
42 | {{ i18n "term.total_posts" (dict "count" (len .Pages)) | default (printf "共 %d 篇文章" (len .Pages)) }}
45 |
46 |
47 | {{ partial "features/icon.html" (dict "name" "calendar" "size" "sm" "ariaLabel" "") }}
48 | {{ i18n "term.date_range" | default "按时间排序" }}
49 |
50 |
51 |
52 |
53 |
54 | {{ $posts := .Pages }}
55 | {{ if $posts }}
56 | {{ partial "content/post-list.html" (dict "posts" $posts) }}
57 | {{ else }}
58 |
59 |
60 |
62 | {{ partial "features/icon.html" (dict "name" "file-text" "size" "xl" "ariaLabel" "") }}
63 |
64 |
65 | {{ i18n "term.no_posts" | default "暂无文章" }}
66 |
67 |
68 | {{ if eq .Data.Singular "tag" }}
69 | {{ i18n "term.no_posts_tag" | default "该标签下还没有文章。" }}
70 | {{ else if eq .Data.Singular "category" }}
71 | {{ i18n "term.no_posts_category" | default "该分类下还没有文章。" }}
72 | {{ else }}
73 | {{ i18n "term.no_posts_desc" | default "该分类下还没有文章。" }}
74 | {{ end }}
75 |
76 |
79 | {{ partial "features/icon.html" (dict "name" "home" "size" "sm" "ariaLabel" "") }}
80 | {{ i18n "nav.back_home" | default "返回首页" }}
81 |
82 |
83 | {{ end }}
84 |
85 | {{ end }}
86 |
--------------------------------------------------------------------------------
/exampleSite/content/posts/alert-test.ja.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "GitHubスタイルアラートテスト"
3 | date: 2025-06-01T10:00:00+08:00
4 | slug: test-alert
5 | draft: false
6 | description: "GitHubスタイルアラートと折りたたみ機能のテスト"
7 | tags: ["テスト", "アラート", "markdown"]
8 | categories: ["Github"]
9 | ---
10 |
11 | # GitHubスタイルアラートテスト
12 |
13 | この記事は新しいGitHubスタイルアラート機能と折りたたみ機能をテストするために使用されます。
14 |
15 | ## アラート構文
16 |
17 | ### ノートアラート
18 |
19 | > [!NOTE]
20 | > これはノートアラートボックスです。コンテンツを素早く閲覧している場合でも、ユーザーが注意すべき有用な情報を表示するために使用されます。
21 |
22 | ### ヒントアラート
23 |
24 | > [!TIP]
25 | > これはヒントアラートボックスです。タスクをより良く、またはより簡単に完了するのに役立つ提案を提供します。
26 |
27 | ### 重要アラート
28 |
29 | > [!IMPORTANT]
30 | > これは重要アラートボックスです。ユーザーがタスクを成功させるために必要な重要な情報を表示します。
31 |
32 | ### 警告アラート
33 |
34 | > [!WARNING]
35 | > これは警告アラートボックスです。潜在的なリスクのため、ユーザーの即座の注意が必要な重要なコンテンツです。
36 |
37 | ### 注意アラート
38 |
39 | > [!CAUTION]
40 | > これは注意アラートボックスです。負の結果を避けるための行動を推奨します。
41 |
42 | ## 折りたたみ機能
43 |
44 | ### 折りたたみ可能なノートアラート
45 |
46 | > [!NOTE]+ 折りたたみ可能な注意事項
47 | > これは折りたたみ可能なノートアラートボックスです。タイトルをクリックしてコンテンツを展開または折りたたむことができます。
48 | >
49 | > ユーザーが必要な時に展開して表示できる詳細情報をここに含めることができます。
50 |
51 | ### 折りたたみ可能なヒントアラート
52 |
53 | > [!TIP]+ 高度な使用のヒント
54 | > この折りたたまれたヒントボックスには高度な使用のヒントが含まれています:
55 | >
56 | > 1. まずこれを行う
57 | > 2. 次にそれを行う
58 | > 3. 最後にこのステップを完了する
59 | >
60 | > これらのステップを順番に実行することを忘れないでください。
61 |
62 | ### 折りたたみ可能な重要アラート
63 |
64 | > [!IMPORTANT]+ 重要な設定情報
65 | > これらの設定はシステムの正常な動作にとって重要です:
66 | >
67 | > ```yaml
68 | > server:
69 | > port: 8080
70 | > host: localhost
71 | > database:
72 | > url: mongodb://localhost:27017
73 | > name: myapp
74 | > ```
75 | >
76 | > すべての設定が正しく構成されていることを確認してください。
77 |
78 | ### 折りたたみ可能な警告アラート
79 |
80 | > [!WARNING]+ セキュリティ警告
81 | > 続行する前に、以下のセキュリティ考慮事項に注意してください:
82 | >
83 | > - すべてのパスワードが強力であることを確認する
84 | > - 二要素認証を有効にする
85 | > - システムを定期的に更新する
86 | > - 公共ネットワークで機密操作を実行しない
87 |
88 | ### 折りたたみ可能な注意アラート
89 |
90 | > [!CAUTION]+ 複雑なコンテンツの例
91 | > この折りたたみボックスには複雑なMarkdownコンテンツが含まれています:
92 | >
93 | > #### サブ見出し
94 | >
95 | > これは[リンク](https://example.com)とその他の書式を含む段落です。
96 | >
97 | > ```javascript
98 | > // コードブロックの例
99 | > function hello() {
100 | > console.log("こんにちは、世界!");
101 | > }
102 | > ```
103 | >
104 | > | テーブル | 例 |
105 | > |---------|---|
106 | > | 行1 | データ1 |
107 | > | 行2 | データ2 |
108 |
109 | ## 通常の引用ブロック
110 |
111 | これはアラートではない通常の引用ブロックです:
112 |
113 | > これは標準の引用ブロックです。アラートとしてレンダリングされず、標準の引用ブロックスタイルを使用します。
114 | >
115 | > 複数行のコンテンツと**書式設定されたテキスト**をサポートします。
116 |
117 | ## 多言語サポート
118 |
119 | アラートは複数の言語をサポートし、タイトルは現在の言語で自動的に表示されます:
120 |
121 | > [!NOTE]
122 | > 日本語環境では、このタイトルは「注意」として表示されます。
123 |
124 | > [!TIP]
125 | > 日本語環境では、このタイトルは「ヒント」として表示されます。
126 |
127 | ## ネストしたコンテンツテスト
128 |
129 | > [!WARNING]+ ネストしたコンテンツテスト
130 | > このアラートにはネストしたコンテンツが含まれています:
131 | >
132 | > > これはネストした引用ブロックです
133 | >
134 | > - リスト項目
135 | > - ネストしたリスト項目
136 | > - 別のネストした項目
137 | >
138 | > 1. 順序付きリスト
139 | > 1. ネストした順序付きリスト
140 | > 2. 別のネストした項目
141 |
142 | ## 使用例
143 |
144 | ### ドキュメント説明
145 |
146 | > [!NOTE]
147 | > この機能はバージョン2.0から利用可能です。古いバージョンを使用している場合は、まずアップグレードしてください。
148 |
149 | ### ベストプラクティス
150 |
151 | > [!TIP]+ パフォーマンス最適化の推奨事項
152 | > 最高のパフォーマンスを得るために推奨されます:
153 | >
154 | > - 静的リソースにCDNを使用する
155 | > - gzip圧縮を有効にする
156 | > - 画像サイズを最適化する
157 | > - ブラウザキャッシュを使用する
158 |
159 | ### 重要な設定
160 |
161 | > [!IMPORTANT]
162 | > 設定ファイルを変更した後、変更を有効にするためにサービスを再起動する必要があります。
163 |
164 | ### セキュリティリマインダー
165 |
166 | > [!WARNING]
167 | > 本番環境でデフォルトパスワードを使用しないでください。
168 |
169 | ### 破壊的操作
170 |
171 | > [!CAUTION]
172 | > この操作はすべてのデータを永続的に削除し、復元できません。重要なデータをバックアップしていることを確認してください。
173 |
174 | これらのアラートは、ユーザーがコンテンツの重要性とコンテキストをよりよく理解するのに役立ち、ドキュメントの可読性とユーザーエクスペリエンスを向上させます。
175 |
--------------------------------------------------------------------------------
/exampleSite/content/posts/alert-test.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "GitHub Style Alert Test"
3 | date: 2025-06-01T10:00:00+08:00
4 | slug: test-alert
5 | draft: false
6 | description: "Testing GitHub-style Alert and folding features"
7 | tags: ["test", "alert", "markdown"]
8 | categories: ["Github"]
9 | ---
10 |
11 | # GitHub Style Alert Testing
12 |
13 | This article is used to test the new GitHub-style Alert feature and folding functionality.
14 |
15 | ## Alert Syntax
16 |
17 | ### Note Alert
18 |
19 | > [!NOTE]
20 | > This is a note alert box. Used to display useful information that users should be aware of, even when quickly browsing the content.
21 |
22 | ### Tip Alert
23 |
24 | > [!TIP]
25 | > This is a tip alert box. Provides suggestions that help complete tasks better or more easily.
26 |
27 | ### Important Alert
28 |
29 | > [!IMPORTANT]
30 | > This is an important alert box. Displays critical information users need to know to achieve their goals.
31 |
32 | ### Warning Alert
33 |
34 | > [!WARNING]
35 | > This is a warning box. Urgent information that requires immediate user attention to avoid problems.
36 |
37 | ### Caution Alert
38 |
39 | > [!CAUTION]
40 | > This is a caution alert box. Advises users to be aware of the risks or negative consequences of certain behaviors.
41 |
42 | ## Extended Syntax - Custom Titles
43 |
44 | ### Note with Custom Title
45 |
46 | > [!NOTE] Custom Title
47 | > This is a note alert box with a custom title.
48 |
49 | ### Warning with Custom Title
50 |
51 | > [!WARNING] Radiation Hazard
52 | > Do not approach or handle without protective equipment.
53 |
54 | ## Folding Feature
55 |
56 | ### Expanded Foldable Alert by Default
57 |
58 | > [!TIP]+ Click to Collapse
59 | > This is an expanded foldable alert box by default. Click the title to collapse the content.
60 | >
61 | > Supports multi-line content:
62 | > - List item 1
63 | > - List item 2
64 | > - List item 3
65 |
66 | ### Collapsed Alert by Default
67 |
68 | > [!IMPORTANT]- Important Information (Collapsed by Default)
69 | > This is an important information box collapsed by default. Click the title to expand and view the content.
70 | >
71 | > Can include:
72 | > 1. Ordered list
73 | > 2. **Bold text**
74 | > 3. *Italic text*
75 | > 4. `Code snippet`
76 |
77 | ### Foldable Alert with Complex Content
78 |
79 | > [!CAUTION]+ Complex Content Example
80 | > This foldable box contains complex Markdown content:
81 | >
82 | > #### Subheading
83 | >
84 | > This is a paragraph containing a [link](https://example.com) and other formatting.
85 | >
86 | > ```javascript
87 | > // Code block example
88 | > function hello() {
89 | > console.log("Hello, World!");
90 | > }
91 | > ```
92 | >
93 | > | Table | Example |
94 | > |------|------|
95 | > | Row1 | Data1 |
96 | > | Row2 | Data2 |
97 |
98 | ## Regular Blockquote
99 |
100 | This is a regular blockquote, not an Alert:
101 |
102 | > This is a standard blockquote. It won't be rendered as an Alert but will use the standard blockquote styling.
103 | >
104 | > Supports multi-line content and **formatted text**.
105 |
106 | ## Multilingual Support
107 |
108 | Alerts support multiple languages, and titles will automatically display in the current language:
109 |
110 | > [!NOTE]
111 | > In a Chinese environment, this title will display as "注意" (Note).
112 |
113 | > [!TIP]
114 | > In a Chinese environment, this title will display as "提示" (Tip).
115 |
116 | ## Nested Content Test
117 |
118 | > [!WARNING]+ Nested Content Test
119 | > This Alert contains nested content:
120 | >
121 | > > This is a nested blockquote
122 | >
123 | > - List item
124 | > - Nested list item
125 | > - Another nested item
126 | >
127 | > 1. Ordered list
128 | > 1. Nested ordered list
129 | > 2. Another nested item
--------------------------------------------------------------------------------
/layouts/_partials/features/katex.html:
--------------------------------------------------------------------------------
1 | {{/* KaTeX 数学公式支持
2 | 支持全局配置和页面级配置,包括自定义 delimiter
3 | */}}
4 |
5 | {{/* 获取全局配置 */}}
6 | {{- $globalKatex := site.Params.katex -}}
7 | {{- $globalEnabled := false -}}
8 | {{- $globalDelimiters := slice -}}
9 |
10 | {{- if $globalKatex -}}
11 | {{- if eq (printf "%T" $globalKatex) "bool" -}}
12 | {{- $globalEnabled = $globalKatex -}}
13 | {{- else -}}
14 | {{- $globalEnabled = $globalKatex.enabled | default false -}}
15 | {{- $globalDelimiters = $globalKatex.delimiters -}}
16 | {{- end -}}
17 | {{- end -}}
18 |
19 | {{/* 获取页面级配置 */}}
20 | {{- $pageKatex := .Params.katex -}}
21 | {{- $pageEnabled := false -}}
22 | {{- $pageDelimiters := slice -}}
23 |
24 | {{- if $pageKatex -}}
25 | {{- if eq (printf "%T" $pageKatex) "bool" -}}
26 | {{- $pageEnabled = $pageKatex -}}
27 | {{- else -}}
28 | {{- $pageEnabled = $pageKatex.enabled | default false -}}
29 | {{- $pageDelimiters = $pageKatex.delimiters -}}
30 | {{- end -}}
31 | {{- end -}}
32 |
33 | {{/* 检查是否需要加载 KaTeX */}}
34 | {{- $shouldLoad := false -}}
35 | {{- if $globalEnabled -}}
36 | {{- $shouldLoad = true -}}
37 | {{- else if $pageEnabled -}}
38 | {{- $shouldLoad = true -}}
39 | {{- end -}}
40 |
41 | {{- if $shouldLoad -}}
42 |
43 |
48 |
53 |
58 |
59 |
108 | {{- end -}}
109 |
--------------------------------------------------------------------------------
/exampleSite/content/posts/code-highlighting-test.zh-cn.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "代码高亮测试"
3 | date: 2024-01-16T10:00:00+08:00
4 | draft: false
5 | description: "测试代码高亮功能"
6 | tags: ["测试", "代码", "语法高亮"]
7 | categories: ["代码高亮"]
8 | slug: code-highlighting-test
9 | ---
10 |
11 | # 代码高亮测试
12 |
13 | 本文用于测试新的代码高亮功能,包括语法高亮、复制按钮、语言显示等。
14 |
15 | ## JavaScript
16 |
17 | ```javascript
18 |
19 | function fibonacci(n) {
20 | if (n <= 1) return n;
21 | return fibonacci(n - 1) + fibonacci(n - 2);
22 | }
23 |
24 |
25 | const result = fibonacci(10);
26 | console.log(`第10个斐波那契数是:${result}`);
27 |
28 | // 异步/等待
29 | const asyncFunction = async () => {
30 | try {
31 | const response = await fetch('/api/data');
32 | const data = await response.json();
33 | return data;
34 | } catch (error) {
35 | console.error('获取数据时出错:', error);
36 | }
37 | };
38 | ```
39 |
40 | ## 带行号的代码块
41 |
42 | ```python {lineNos=true}
43 | # 带行号的 Python 代码
44 | import asyncio
45 | from typing import List, Optional
46 |
47 | class DataProcessor:
48 | def __init__(self, data: List[dict]):
49 | self.data = data
50 |
51 | def process(self) -> Optional[dict]:
52 | """处理数据并返回结果"""
53 | if not self.data:
54 | return None
55 |
56 | result = {
57 | 'total': len(self.data),
58 | 'processed': []
59 | }
60 |
61 | for item in self.data:
62 | if self.validate_item(item):
63 | result['processed'].append(item)
64 |
65 | return result
66 | ```
67 |
68 | ## 高亮特定行
69 |
70 | ```go {lineNos=true hl_lines=[3,6,8]}
71 | package main
72 |
73 | import "fmt" // 这一行将被高亮
74 |
75 | func main() {
76 | message := "你好,世界!" // 这一行也将被高亮
77 |
78 | fmt.Println(message) // 这一行也将被高亮
79 |
80 | for i := 0; i < 3; i++ {
81 | fmt.Printf("计数:%d\n", i)
82 | }
83 | }
84 | ```
85 |
86 |
87 | ## 带文件名的代码块
88 |
89 | ```typescript {filename="api.ts"}
90 | // TypeScript API
91 | interface ApiResponse {
92 | data: T;
93 | status: number;
94 | message: string;
95 | }
96 |
97 | interface User {
98 | id: number;
99 | name: string;
100 | email: string;
101 | avatar?: string;
102 | }
103 |
104 | class ApiClient {
105 | private baseURL: string;
106 | private headers: Record;
107 |
108 | constructor(baseURL: string, apiKey?: string) {
109 | this.baseURL = baseURL;
110 | this.headers = {
111 | 'Content-Type': 'application/json',
112 | ...(apiKey && { 'Authorization': `Bearer ${apiKey}` })
113 | };
114 | }
115 |
116 | async get(endpoint: string): Promise> {
117 | const response = await fetch(`${this.baseURL}${endpoint}`, {
118 | method: 'GET',
119 | headers: this.headers,
120 | });
121 |
122 | if (!response.ok) {
123 | throw new Error(`HTTP 错误!状态:${response.status}`);
124 | }
125 |
126 | return response.json();
127 | }
128 |
129 | async post(endpoint: string, data: any): Promise> {
130 | const response = await fetch(`${this.baseURL}${endpoint}`, {
131 | method: 'POST',
132 | headers: this.headers,
133 | body: JSON.stringify(data),
134 | });
135 |
136 | return response.json();
137 | }
138 | }
139 |
140 | const client = new ApiClient('https://api.example.com', 'your-api-key');
141 |
142 | async function getUsers(): Promise {
143 | try {
144 | const response = await client.get('/users');
145 | return response.data;
146 | } catch (error) {
147 | console.error('获取用户时出错:', error);
148 | return [];
149 | }
150 | }
151 | ```
152 |
153 |
154 | ## 纯文本代码块
155 |
156 | ```
157 | 这是一个纯文本代码块。
158 | 它不应该有语法高亮。
159 | 你可以在这里测试复制功能。
160 |
161 | function test() {
162 | console.log("这是一个测试。");
163 | }
164 | ```
165 |
166 | ## 行内代码
167 |
168 | 这是一个行内代码示例:`const x = 42;` 和 `npm install` 以及 `git commit -m "更新"`。
169 |
170 | ---
171 |
--------------------------------------------------------------------------------
/exampleSite/content/posts/katex-mermaid-test.zh-cn.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "KaTeX 和 Mermaid 测试"
3 | date: 2024-01-17T10:00:00+08:00
4 | draft: false
5 | description: "测试 KaTeX 数学公式和 Mermaid 图表渲染功能"
6 | tags: ["测试", "katex", "mermaid", "数学", "图表"]
7 | categories: ["数学图表"]
8 | slug: katex-mermaid-test
9 | katex: true
10 | mermaid: true
11 | ---
12 |
13 | # KaTeX 和 Mermaid 测试
14 |
15 | 本文用于测试 KaTeX 数学公式渲染和 Mermaid 图表功能。
16 |
17 | ## Mermaid 图表测试
18 |
19 | ### 流程图
20 |
21 | ```mermaid
22 | graph TD
23 | A[开始] --> B{是否为用户?}
24 | B -->|是| C[显示用户界面]
25 | B -->|否| D[显示登录页面]
26 | C --> E[用户操作]
27 | D --> F[用户登录]
28 | F --> G{登录成功?}
29 | G -->|是| C
30 | G -->|否| H[显示错误信息]
31 | H --> D
32 | E --> I[结束]
33 | ```
34 |
35 | ### 序列图
36 |
37 | ```mermaid
38 | sequenceDiagram
39 | participant 用户
40 | participant 浏览器
41 | participant 服务器
42 | participant 数据库
43 |
44 | 用户->>浏览器: 输入网址
45 | 浏览器->>服务器: 发送HTTP请求
46 | 服务器->>数据库: 查询数据
47 | 数据库-->>服务器: 返回数据
48 | 服务器-->>浏览器: 返回HTML
49 | 浏览器-->>用户: 显示页面
50 | ```
51 |
52 | ### 甘特图
53 |
54 | ```mermaid
55 | gantt
56 | title 项目开发时间线
57 | dateFormat YYYY-MM-DD
58 | section 设计阶段
59 | 需求分析 :done, des1, 2024-01-01,2024-01-05
60 | UI设计 :done, des2, 2024-01-06, 2024-01-12
61 | 原型制作 :active, des3, 2024-01-13, 2024-01-18
62 | section 开发阶段
63 | 前端开发 : dev1, 2024-01-19, 2024-02-15
64 | 后端开发 : dev2, 2024-01-19, 2024-02-20
65 | 数据库设计 : dev3, 2024-01-19, 2024-01-25
66 | section 测试阶段
67 | 单元测试 : test1, 2024-02-16, 2024-02-25
68 | 集成测试 : test2, 2024-02-21, 2024-03-01
69 | 用户测试 : test3, 2024-02-26, 2024-03-05
70 | ```
71 |
72 |
73 | ## KaTeX 测试
74 |
75 | ### 行内公式
76 |
77 | 这是一个行内公式:$E = mc^2$,爱因斯坦的质能等价公式。
78 |
79 | 另一个例子:当 $a \neq 0$ 时,二次方程 $ax^2 + bx + c = 0$ 的解为 $x = \frac{-b \pm \sqrt{b^2-4ac}}{2a}$。
80 |
81 | ### 块级公式
82 | #### 二次公式
83 | $$x = \frac{-b \pm \sqrt{b^2-4ac}}{2a}$$
84 |
85 | #### 欧拉公式
86 | $$e^{i\pi} + 1 = 0$$
87 |
88 | #### 积分公式
89 | $$\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}$$
90 |
91 | #### 矩阵表示
92 | $$\begin{pmatrix} a & b \\ c & d \end{pmatrix} \begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} ax + by \\ cx + dy \end{pmatrix}$$
93 |
94 | #### 求和公式
95 | $$\sum_{n=1}^{\infty} \frac{1}{n^2} = \frac{\pi^2}{6}$$
96 |
97 | #### 微分方程
98 | $$\frac{d^2y}{dx^2} + \omega^2 y = 0$$
99 |
100 | #### 傅里叶变换
101 | $$F(\omega) = \int_{-\infty}^{\infty} f(t) e^{-i\omega t} dt$$
102 |
103 | #### 泰勒级数
104 | $$f(x) = \sum_{n=0}^{\infty} \frac{f^{(n)}(a)}{n!}(x-a)^n$$
105 |
106 | ### 复杂数学表达式
107 |
108 | #### 概率密度函数
109 | $$f(x) = \frac{1}{\sigma\sqrt{2\pi}} e^{-\frac{1}{2}\left(\frac{x-\mu}{\sigma}\right)^2}$$
110 |
111 | #### 麦克斯韦方程组
112 | $$\begin{align}
113 | \nabla \cdot \mathbf{E} &= \frac{\rho}{\epsilon_0} \\
114 | \nabla \cdot \mathbf{B} &= 0 \\
115 | \nabla \times \mathbf{E} &= -\frac{\partial \mathbf{B}}{\partial t} \\
116 | \nabla \times \mathbf{B} &= \mu_0\mathbf{J} + \mu_0\epsilon_0\frac{\partial \mathbf{E}}{\partial t}
117 | \end{align}$$
118 |
119 | #### 薛定谔方程
120 | $$i\hbar\frac{\partial}{\partial t}\Psi(\mathbf{r},t) = \hat{H}\Psi(\mathbf{r},t)$$
121 |
122 | ## 组合测试
123 |
124 | ### 带公式的流程图
125 |
126 | ```mermaid
127 | graph LR
128 | A["输入: $f(x) = ax^2 + bx + c$"] --> B["计算判别式: $\Delta = b^2 - 4ac$"]
129 | B --> C{"$\Delta > 0$?"}
130 | C -->|是| D["两个实根: $x = \frac{-b \pm \sqrt{\Delta}}{2a}$"]
131 | C -->|否| E{"$\Delta = 0$?"}
132 | E -->|是| F["一个实根: $x = \frac{-b}{2a}$"]
133 | E -->|否| G["无实根"]
134 | ```
135 |
136 | ### 数学概念解释
137 |
138 | 在数学中,**黄金比例** $\phi$ 定义为:
139 |
140 | $$\phi = \frac{1 + \sqrt{5}}{2} \approx 1.618$$
141 |
142 | 它满足以下性质:
143 |
144 | $$\phi^2 = \phi + 1$$
145 |
146 | 这个比例在自然界和艺术中都有广泛应用。
147 |
148 | ---
149 |
150 | 这个测试页面展示了 KaTeX 和 Mermaid 的各种功能,包括复杂的数学公式和多种类型的图表。
151 |
--------------------------------------------------------------------------------
/layouts/_partials/layout/footer.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/exampleSite/content/posts/markdown-test.zh-cn.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Markdown 语法测试文档"
3 | date: 2024-01-15T10:00:00+08:00
4 | draft: false
5 | summary: "这是一个包含各种 Markdown 语法的测试文档,用于验证文档样式的完整性。"
6 | categories: ["测试"]
7 | tags: ["markdown", "文档", "样式"]
8 | ---
9 |
10 | # 一级标题
11 |
12 | 这是一级标题下的段落。
13 |
14 | ## 二级标题
15 |
16 | 这是二级标题下的段落。
17 |
18 | ### 三级标题
19 |
20 | 这是三级标题下的段落。
21 |
22 | #### 四级标题
23 |
24 | 这是四级标题下的段落。
25 |
26 | ##### 五级标题
27 |
28 | 这是五级标题下的段落。
29 |
30 | ###### 六级标题
31 |
32 | 这是六级标题下的段落。
33 |
34 | ## 段落和文本格式
35 |
36 | 这是一个普通段落。它可以包含**粗体文本**、*斜体文本*、***粗斜体文本***、~~删除线~~、`行内代码`和[链接文本](https://example.com)。
37 |
38 | 这是另一个段落,用于测试段落之间的间距。
39 |
40 | ## 引用块
41 |
42 | > 这是一个简单的引用块。
43 | >
44 | > 引用块可以包含多个段落。
45 |
46 | > 这是一个嵌套引用的例子:
47 | >
48 | > > 这是嵌套引用的内容。
49 | > >
50 | > > 可以有多层嵌套。
51 |
52 | ## 列表
53 |
54 | ### 无序列表
55 |
56 | - 第一项
57 | - 第二项
58 | - 嵌套项 1
59 | - 嵌套项 2
60 | - 更深层的嵌套项
61 | - 第三项
62 |
63 | ### 有序列表
64 |
65 | 1. 第一项
66 | 2. 第二项
67 | 1. 嵌套有序项 1
68 | 2. 嵌套有序项 2
69 | 1. 更深层的嵌套项
70 | 3. 第三项
71 |
72 | ### 任务列表(复选框)
73 |
74 | - [x] 已完成的任务
75 | - [ ] 未完成的任务
76 | - [x] 另一个已完成的任务
77 | - [ ] 嵌套任务列表
78 | - [x] 子任务 1(已完成)
79 | - [ ] 子任务 2(未完成)
80 | - [x] 子任务 3(已完成)
81 |
82 | ### 定义列表
83 |
84 | 术语 1
85 | : 这是术语 1 的定义。
86 |
87 | 术语 2
88 | : 这是术语 2 的定义。
89 | : 术语可以有多个定义。
90 |
91 | ## 代码
92 |
93 | ### 行内代码
94 |
95 | 这是一个包含 `console.log('Hello World')` 的段落。
96 |
97 | ### 代码块
98 |
99 | ```javascript
100 | function greet(name) {
101 | console.log(`你好,${name}!`);
102 | }
103 |
104 | greet('世界');
105 | ```
106 |
107 | ```python
108 | def fibonacci(n):
109 | if n <= 1:
110 | return n
111 | return fibonacci(n-1) + fibonacci(n-2)
112 |
113 | print(fibonacci(10))
114 | ```
115 |
116 | ```css
117 | .prose {
118 | max-width: none;
119 | color: var(--tw-prose-body);
120 | }
121 |
122 | .prose h1 {
123 | font-size: 2.25rem;
124 | font-weight: 700;
125 | }
126 | ```
127 |
128 | ## 表格
129 |
130 | | 左对齐 | 居中对齐 | 右对齐 |
131 | |:-------|:--------:|-------:|
132 | | 内容 1 | 内容 2 | 内容 3 |
133 | | 较长的内容 | 中等 | 短 |
134 | | 数据 A | 数据 B | 数据 C |
135 |
136 | ## 水平分割线
137 |
138 | ---
139 |
140 | ## 图片
141 |
142 | 
143 |
144 | ## 链接
145 |
146 | 这是一个[普通链接](https://example.com)。
147 |
148 | 这是一个[带标题的链接](https://example.com "链接标题")。
149 |
150 | 这是一个引用式链接:[引用链接][1]
151 |
152 | [1]: https://example.com "引用链接标题"
153 |
154 | ## 脚注
155 |
156 | 这是一个包含脚注的段落[^1]。
157 |
158 | 这里是另一个脚注[^note]。
159 |
160 | [^1]: 这是第一个脚注的内容。
161 |
162 | [^note]: 这是命名脚注的内容。
163 |
164 | ## 高亮文本
165 |
166 | 这是一个包含==高亮文本==的段落。
167 |
168 | ## 上标和下标
169 |
170 | H~2~O 是水的化学分子式。
171 |
172 | E = mc^2^ 是爱因斯坦的质能方程。
173 |
174 | ## 键盘按键
175 |
176 | 按 Ctrl + C 复制文本。
177 |
178 | ## 缩写
179 |
180 | HTML 是*超文本标记语言*的缩写。
181 |
182 | *[HTML]: 超文本标记语言
183 |
184 | ## 数学公式(如果支持 KaTeX)
185 |
186 | 行内公式:$E = mc^2$
187 |
188 | 块级公式:
189 |
190 | $$
191 | \int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}
192 | $$
193 |
194 | ## 提示框(如果支持)
195 |
196 | > [!NOTE]
197 | > 这是一个注意事项。
198 |
199 | > [!TIP]
200 | > 这是一个提示。
201 |
202 | > [!IMPORTANT]
203 | > 这是重要信息。
204 |
205 | > [!WARNING]
206 | > 这是一个警告。
207 |
208 | > [!CAUTION]
209 | > 这是一个注意事项。
210 |
211 | ## 详情(如果支持)
212 |
213 |
214 | 点击展开详情
215 |
216 | 这是折叠的详细内容。
217 |
218 | 你可以在这里包含任何 Markdown 语法:
219 |
220 | - 列表项
221 | - **粗体文本**
222 | - `代码`
223 |
224 |
225 |
226 | ## 混合内容测试
227 |
228 | 这个段落包含多种格式:**粗体**、*斜体*、`代码`、[链接](https://example.com)、~~删除线~~、==高亮==。
229 |
230 | ### 复杂列表
231 |
232 | 1. 包含**粗体**文本的第一项
233 | - 包含`代码`的嵌套项
234 | - 包含[链接](https://example.com)的另一个嵌套项
235 | 2. 包含*斜体*文本的第二项
236 | 1. 有序嵌套项
237 | 2. 另一个有序嵌套项
238 | 3. 包含~~删除线~~文本的第三项
239 |
240 | ### 复杂表格
241 |
242 | | 功能 | 状态 | 描述 |
243 | |------|:----:|----|
244 | | **粗体** | ✅ | 支持粗体文本 |
245 | | *斜体* | ✅ | 支持斜体 |
246 | | `代码` | ✅ | 支持行内代码 |
247 | | [链接](https://example.com) | ✅ | 支持链接 |
248 | | ~~删除线~~ | ❌ | 需要测试 |
249 |
250 | 这个测试文档涵盖了大多数常见的 Markdown 语法,可以用来验证文档样式的完整性和美观性。
251 |
--------------------------------------------------------------------------------
/exampleSite/content/posts/code-highlighting-test.ja.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "コードハイライトテスト"
3 | date: 2024-01-16T10:00:00+08:00
4 | draft: false
5 | description: "コードハイライト機能のテスト"
6 | tags: ["テスト", "コード", "シンタックスハイライト"]
7 | categories: ["コードハイライト"]
8 | slug: code-highlighting-test
9 | ---
10 |
11 | # コードハイライトテスト
12 |
13 | この記事は新しいコードハイライト機能をテストするために使用されます。シンタックスハイライト、コピーボタン、言語表示などが含まれます。
14 |
15 | ## JavaScript
16 |
17 | ```javascript
18 |
19 | function fibonacci(n) {
20 | if (n <= 1) return n;
21 | return fibonacci(n - 1) + fibonacci(n - 2);
22 | }
23 |
24 |
25 | const result = fibonacci(10);
26 | console.log(`10番目のフィボナッチ数は:${result}`);
27 |
28 | // 非同期/待機
29 | const asyncFunction = async () => {
30 | try {
31 | const response = await fetch('/api/data');
32 | const data = await response.json();
33 | return data;
34 | } catch (error) {
35 | console.error('データ取得エラー:', error);
36 | }
37 | };
38 | ```
39 |
40 | ## 行番号付きコードブロック
41 |
42 | ```python {lineNos=true}
43 | # 行番号付きPythonコード
44 | import asyncio
45 | from typing import List, Optional
46 |
47 | class DataProcessor:
48 | def __init__(self, data: List[dict]):
49 | self.data = data
50 |
51 | def process(self) -> Optional[dict]:
52 | """データを処理して結果を返す"""
53 | if not self.data:
54 | return None
55 |
56 | result = {
57 | 'total': len(self.data),
58 | 'processed': []
59 | }
60 |
61 | for item in self.data:
62 | if self.validate_item(item):
63 | result['processed'].append(item)
64 |
65 | return result
66 | ```
67 |
68 | ## 特定行のハイライト
69 |
70 | ```go {lineNos=true hl_lines=[3,6,8]}
71 | package main
72 |
73 | import "fmt" // この行がハイライトされます
74 |
75 | func main() {
76 | message := "こんにちは、世界!" // この行もハイライトされます
77 |
78 | fmt.Println(message) // この行もハイライトされます
79 |
80 | for i := 0; i < 3; i++ {
81 | fmt.Printf("カウント:%d\n", i)
82 | }
83 | }
84 | ```
85 |
86 | ## ファイル名付きコードブロック
87 |
88 | ```typescript {filename="api.ts"}
89 | // TypeScript API
90 | interface ApiResponse {
91 | data: T;
92 | status: number;
93 | message: string;
94 | }
95 |
96 | interface User {
97 | id: number;
98 | name: string;
99 | email: string;
100 | avatar?: string;
101 | }
102 |
103 | class ApiClient {
104 | private baseURL: string;
105 | private headers: Record;
106 |
107 | constructor(baseURL: string, apiKey?: string) {
108 | this.baseURL = baseURL;
109 | this.headers = {
110 | 'Content-Type': 'application/json',
111 | ...(apiKey && { 'Authorization': `Bearer ${apiKey}` })
112 | };
113 | }
114 |
115 | async get(endpoint: string): Promise> {
116 | const response = await fetch(`${this.baseURL}${endpoint}`, {
117 | method: 'GET',
118 | headers: this.headers,
119 | });
120 |
121 | if (!response.ok) {
122 | throw new Error(`HTTPエラー!ステータス:${response.status}`);
123 | }
124 |
125 | return response.json();
126 | }
127 |
128 | async post(endpoint: string, data: any): Promise> {
129 | const response = await fetch(`${this.baseURL}${endpoint}`, {
130 | method: 'POST',
131 | headers: this.headers,
132 | body: JSON.stringify(data),
133 | });
134 |
135 | return response.json();
136 | }
137 | }
138 |
139 | const client = new ApiClient('https://api.example.com', 'your-api-key');
140 |
141 | async function getUsers(): Promise {
142 | try {
143 | const response = await client.get('/users');
144 | return response.data;
145 | } catch (error) {
146 | console.error('ユーザー取得エラー:', error);
147 | return [];
148 | }
149 | }
150 | ```
151 |
152 | ## プレーンテキストコードブロック
153 |
154 | ```
155 | これはプレーンテキストコードブロックです。
156 | シンタックスハイライトはありません。
157 | ここでコピー機能をテストできます。
158 |
159 | function test() {
160 | console.log("これはテストです。");
161 | }
162 | ```
163 |
164 | ## インラインコード
165 |
166 | これはインラインコードの例です:`const x = 42;` と `npm install` と `git commit -m "更新"`。
167 |
168 | ---
169 |
--------------------------------------------------------------------------------
/layouts/_partials/navigation/header.html:
--------------------------------------------------------------------------------
1 |
98 |
--------------------------------------------------------------------------------
/exampleSite/content/posts/katex-mermaid-test.ja.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "KaTeXとMermaidテスト"
3 | date: 2024-01-17T10:00:00+08:00
4 | draft: false
5 | description: "KaTeX数式とMermaidチャートレンダリング機能のテスト"
6 | tags: ["テスト", "katex", "mermaid", "数学", "チャート"]
7 | categories: ["数学チャート"]
8 | slug: katex-mermaid-test
9 | katex: true
10 | mermaid: true
11 | ---
12 |
13 | # KaTeXとMermaidテスト
14 |
15 | この記事はKaTeX数式レンダリングとMermaidチャート機能をテストするために使用されます。
16 |
17 | ## Mermaidチャートテスト
18 |
19 | ### フローチャート
20 |
21 | ```mermaid
22 | graph TD
23 | A[開始] --> B{ユーザーですか?}
24 | B -->|はい| C[ユーザーインターフェースを表示]
25 | B -->|いいえ| D[ログインページを表示]
26 | C --> E[ユーザー操作]
27 | D --> F[ユーザーログイン]
28 | F --> G{ログイン成功?}
29 | G -->|はい| C
30 | G -->|いいえ| H[エラーメッセージを表示]
31 | H --> D
32 | E --> I[終了]
33 | ```
34 |
35 | ### シーケンス図
36 |
37 | ```mermaid
38 | sequenceDiagram
39 | participant ユーザー
40 | participant ブラウザ
41 | participant サーバー
42 | participant データベース
43 |
44 | ユーザー->>ブラウザ: URLを入力
45 | ブラウザ->>サーバー: HTTPリクエストを送信
46 | サーバー->>データベース: データを照会
47 | データベース-->>サーバー: データを返す
48 | サーバー-->>ブラウザ: HTMLを返す
49 | ブラウザ-->>ユーザー: ページを表示
50 | ```
51 |
52 | ### ガントチャート
53 |
54 | ```mermaid
55 | gantt
56 | title プロジェクト開発タイムライン
57 | dateFormat YYYY-MM-DD
58 | section 設計段階
59 | 要件分析 :done, des1, 2024-01-01,2024-01-05
60 | UI設計 :done, des2, 2024-01-06, 2024-01-12
61 | プロトタイプ作成 :active, des3, 2024-01-13, 2024-01-18
62 | section 開発段階
63 | フロントエンド開発 : dev1, 2024-01-19, 2024-02-15
64 | バックエンド開発 : dev2, 2024-01-19, 2024-02-20
65 | データベース設計 : dev3, 2024-01-19, 2024-01-25
66 | section テスト段階
67 | 単体テスト : test1, 2024-02-16, 2024-02-25
68 | 統合テスト : test2, 2024-02-21, 2024-03-01
69 | ユーザーテスト : test3, 2024-02-26, 2024-03-05
70 | ```
71 |
72 |
73 | ## KaTeXテスト
74 |
75 | ### インライン数式
76 |
77 | これはインライン数式です:$E = mc^2$、アインシュタインの質量エネルギー等価式。
78 |
79 | 別の例:$a \neq 0$ のとき、二次方程式 $ax^2 + bx + c = 0$ の解は $x = \frac{-b \pm \sqrt{b^2-4ac}}{2a}$ です。
80 |
81 | ### ブロック数式
82 | #### 二次公式
83 | $$x = \frac{-b \pm \sqrt{b^2-4ac}}{2a}$$
84 |
85 | #### オイラーの公式
86 | $$e^{i\pi} + 1 = 0$$
87 |
88 | #### 積分公式
89 | $$\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}$$
90 |
91 | #### 行列表現
92 | $$\begin{pmatrix} a & b \\ c & d \end{pmatrix} \begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} ax + by \\ cx + dy \end{pmatrix}$$
93 |
94 | #### 総和公式
95 | $$\sum_{n=1}^{\infty} \frac{1}{n^2} = \frac{\pi^2}{6}$$
96 |
97 | #### 微分方程式
98 | $$\frac{d^2y}{dx^2} + \omega^2 y = 0$$
99 |
100 | #### フーリエ変換
101 | $$F(\omega) = \int_{-\infty}^{\infty} f(t) e^{-i\omega t} dt$$
102 |
103 | #### テイラー級数
104 | $$f(x) = \sum_{n=0}^{\infty} \frac{f^{(n)}(a)}{n!}(x-a)^n$$
105 |
106 | ### 複雑な数学表現
107 |
108 | #### 確率密度関数
109 | $$f(x) = \frac{1}{\sigma\sqrt{2\pi}} e^{-\frac{1}{2}\left(\frac{x-\mu}{\sigma}\right)^2}$$
110 |
111 | #### マクスウェル方程式
112 | $$\begin{align}
113 | \nabla \cdot \mathbf{E} &= \frac{\rho}{\epsilon_0} \\
114 | \nabla \cdot \mathbf{B} &= 0 \\
115 | \nabla \times \mathbf{E} &= -\frac{\partial \mathbf{B}}{\partial t} \\
116 | \nabla \times \mathbf{B} &= \mu_0\mathbf{J} + \mu_0\epsilon_0\frac{\partial \mathbf{E}}{\partial t}
117 | \end{align}$$
118 |
119 | #### シュレーディンガー方程式
120 | $$i\hbar\frac{\partial}{\partial t}\Psi(\mathbf{r},t) = \hat{H}\Psi(\mathbf{r},t)$$
121 |
122 | ## 組み合わせテスト
123 |
124 | ### 数式付きフローチャート
125 |
126 | ```mermaid
127 | graph LR
128 | A["入力: $f(x) = ax^2 + bx + c$"] --> B["判別式を計算: $\Delta = b^2 - 4ac$"]
129 | B --> C{"$\Delta > 0$?"}
130 | C -->|はい| D["2つの実根: $x = \frac{-b \pm \sqrt{\Delta}}{2a}$"]
131 | C -->|いいえ| E{"$\Delta = 0$?"}
132 | E -->|はい| F["1つの実根: $x = \frac{-b}{2a}$"]
133 | E -->|いいえ| G["実根なし"]
134 | ```
135 |
136 | ### 数学概念の説明
137 |
138 | 数学において、**黄金比** $\phi$ は次のように定義されます:
139 |
140 | $$\phi = \frac{1 + \sqrt{5}}{2} \approx 1.618$$
141 |
142 | これは以下の性質を満たします:
143 |
144 | $$\phi^2 = \phi + 1$$
145 |
146 | この比率は自然界と芸術の両方で広く応用されています。
147 |
148 | ---
149 |
150 | このテストページはKaTeXとMermaidの様々な機能を示しており、複雑な数学式と複数種類のチャートが含まれています。
151 |
--------------------------------------------------------------------------------
/layouts/home.html:
--------------------------------------------------------------------------------
1 | {{ define "main" }}
2 |
3 |
4 | {{/* 优先使用页面配置,否则回退站点配置 */}}
5 | {{ $author := .Params.author | default site.Params.author }}
6 |
7 | {{ if $author }}
8 |
9 |
10 |
12 |
13 |
14 | {{ if $author.avatar }}
15 |

19 | {{ else }}
20 |
21 |
23 | {{ substr ($author.name | default site.Title) 0 1 | upper }}
24 |
25 | {{ end }}
26 |
27 |
28 |
29 |
30 |
31 | {{ $author.name | default site.Title }}
32 |
33 |
34 | {{ if $author.title }}
35 |
36 | {{ $author.title }}
37 |
38 | {{ end }}
39 |
40 | {{ if $author.description }}
41 |
42 | {{ $author.description }}
43 |
44 | {{ end }}
45 |
46 |
47 | {{ if $author.social }}
48 |
64 | {{ end }}
65 |
66 |
67 |
68 |
69 | {{ end }}
70 |
71 | {{/* 自定义内容模板引入 */}}
72 | {{ if site.Params.home_custom.enabled }}
73 | {{ $customFiles := site.Params.home_custom.files }}
74 | {{ if $customFiles }}
75 |
76 | {{ range $customFiles }}
77 | {{ $partialPath := printf "content/%s" . }}
78 | {{ partial $partialPath $ }}
79 | {{ end }}
80 |
81 | {{ end }}
82 | {{ end }}
83 |
84 |
85 |
86 | {{ $recentPostsCount := site.Params.home.recentPostsCount | default 5 }}
87 | {{ $posts := where site.RegularPages "Section" "posts" | first $recentPostsCount }}
88 |
89 | {{ partial "content/post-list.html" (dict
90 | "posts" $posts
91 | "title" (i18n "home.recent_posts" | default "最近文章")
92 | "showTitle" true
93 | "showViewAll" true
94 | "viewAllUrl" ("/posts/" | relLangURL)
95 | )
96 | }}
97 |
98 |
99 | {{ if .Content }}
100 |
101 |
102 | {{ .Content }}
103 |
104 |
105 | {{ end }}
106 |
107 |
108 | {{ end }}
--------------------------------------------------------------------------------
/exampleSite/content/posts/code-highlighting-test.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Code Highlighting Test"
3 | date: 2024-01-16T10:00:00+08:00
4 | draft: false
5 | description: "Testing code highlighting features"
6 | tags: ["test", "code", "syntax-highlighting"]
7 | categories: ["code-highlighting"]
8 | slug: code-highlighting-test
9 | ---
10 |
11 | # Code Highlighting Test
12 |
13 | This article is used to test the new code highlighting feature, including syntax highlighting, copy button, language display, etc.
14 |
15 | ## JavaScript
16 |
17 | ```javascript
18 |
19 | function fibonacci(n) {
20 | if (n <= 1) return n;
21 | return fibonacci(n - 1) + fibonacci(n - 2);
22 | }
23 |
24 |
25 | const result = fibonacci(10);
26 | console.log(`The 10th Fibonacci number is: ${result}`);
27 |
28 | // Async/Await
29 | const asyncFunction = async () => {
30 | try {
31 | const response = await fetch('/api/data');
32 | const data = await response.json();
33 | return data;
34 | } catch (error) {
35 | console.error('Error fetching data:', error);
36 | }
37 | };
38 | ```
39 |
40 | ## Codeblock with Line Numbers
41 |
42 | ```python {lineNos=true}
43 | # Python with line numbers
44 | import asyncio
45 | from typing import List, Optional
46 |
47 | class DataProcessor:
48 | def __init__(self, data: List[dict]):
49 | self.data = data
50 |
51 | def process(self) -> Optional[dict]:
52 | """Process the data and return the result"""
53 | if not self.data:
54 | return None
55 |
56 | result = {
57 | 'total': len(self.data),
58 | 'processed': []
59 | }
60 |
61 | for item in self.data:
62 | if self.validate_item(item):
63 | result['processed'].append(item)
64 |
65 | return result
66 | ```
67 |
68 | ## Highlighting Specific Lines
69 |
70 | ```go {lineNos=true hl_lines=[3,6,8]}
71 | package main
72 |
73 | import "fmt" // This line will be highlighted
74 |
75 | func main() {
76 | message := "Hello, World!" // This line will also be highlighted
77 |
78 | fmt.Println(message) // This line will also be highlighted
79 |
80 | for i := 0; i < 3; i++ {
81 | fmt.Printf("Count: %d\n", i)
82 | }
83 | }
84 | ```
85 |
86 |
87 | ## Codeblock with Filename
88 |
89 | ```typescript {filename="api.ts"}
90 | // TypeScript API
91 | interface ApiResponse {
92 | data: T;
93 | status: number;
94 | message: string;
95 | }
96 |
97 | interface User {
98 | id: number;
99 | name: string;
100 | email: string;
101 | avatar?: string;
102 | }
103 |
104 | class ApiClient {
105 | private baseURL: string;
106 | private headers: Record;
107 |
108 | constructor(baseURL: string, apiKey?: string) {
109 | this.baseURL = baseURL;
110 | this.headers = {
111 | 'Content-Type': 'application/json',
112 | ...(apiKey && { 'Authorization': `Bearer ${apiKey}` })
113 | };
114 | }
115 |
116 | async get(endpoint: string): Promise> {
117 | const response = await fetch(`${this.baseURL}${endpoint}`, {
118 | method: 'GET',
119 | headers: this.headers,
120 | });
121 |
122 | if (!response.ok) {
123 | throw new Error(`HTTP error! status: ${response.status}`);
124 | }
125 |
126 | return response.json();
127 | }
128 |
129 | async post(endpoint: string, data: any): Promise> {
130 | const response = await fetch(`${this.baseURL}${endpoint}`, {
131 | method: 'POST',
132 | headers: this.headers,
133 | body: JSON.stringify(data),
134 | });
135 |
136 | return response.json();
137 | }
138 | }
139 |
140 | const client = new ApiClient('https://api.example.com', 'your-api-key');
141 |
142 | async function getUsers(): Promise {
143 | try {
144 | const response = await client.get('/users');
145 | return response.data;
146 | } catch (error) {
147 | console.error('Error fetching users:', error);
148 | return [];
149 | }
150 | }
151 | ```
152 |
153 |
154 | ## Plain Text Codeblock
155 |
156 | ```
157 | This is a plain text codeblock.
158 | It should not have syntax highlighting.
159 | You can test the copy functionality here.
160 |
161 | function test() {
162 | console.log("This is a test.");
163 | }
164 | ```
165 |
166 | ## Inline Code
167 |
168 | This is an inline code example:`const x = 42;` and `npm install` and `git commit -m "update"`.
169 |
170 | ---
171 |
172 |
--------------------------------------------------------------------------------
/exampleSite/content/posts/markdown-test.ja.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Markdown構文テストドキュメント"
3 | date: 2024-01-15T10:00:00+08:00
4 | draft: false
5 | summary: "これは様々なMarkdown構文を含むテストドキュメントで、プロススタイルの完全性を検証するためのものです。"
6 | categories: ["テスト"]
7 | tags: ["markdown", "プロス", "スタイル"]
8 | ---
9 |
10 | # 見出し1
11 |
12 | これは見出し1の下の段落です。
13 |
14 | ## 見出し2
15 |
16 | これは見出し2の下の段落です。
17 |
18 | ### 見出し3
19 |
20 | これは見出し3の下の段落です。
21 |
22 | #### 見出し4
23 |
24 | これは見出し4の下の段落です。
25 |
26 | ##### 見出し5
27 |
28 | これは見出し5の下の段落です。
29 |
30 | ###### 見出し6
31 |
32 | これは見出し6の下の段落です。
33 |
34 | ## 段落とテキスト書式
35 |
36 | これは通常の段落です。**太字テキスト**、*斜体テキスト*、***太字斜体テキスト***、~~取り消し線~~、`インラインコード`、[リンクテキスト](https://example.com)を含むことができます。
37 |
38 | これは段落間のスペースをテストするための別の段落です。
39 |
40 | ## 引用ブロック
41 |
42 | > これはシンプルな引用ブロックです。
43 | >
44 | > 引用ブロックは複数の段落を含むことができます。
45 |
46 | > これはネストした引用の例です:
47 | >
48 | > > これはネストした引用の内容です。
49 | > >
50 | > > 複数レベルのネストが可能です。
51 |
52 | ## リスト
53 |
54 | ### 順序なしリスト
55 |
56 | - 最初の項目
57 | - 2番目の項目
58 | - ネストした項目1
59 | - ネストした項目2
60 | - さらに深いネストした項目
61 | - 3番目の項目
62 |
63 | ### 順序付きリスト
64 |
65 | 1. 最初の項目
66 | 2. 2番目の項目
67 | 1. ネストした順序付き項目1
68 | 2. ネストした順序付き項目2
69 | 1. さらに深いネストした項目
70 | 3. 3番目の項目
71 |
72 | ### タスクリスト(チェックボックス)
73 |
74 | - [x] 完了したタスク
75 | - [ ] 未完了のタスク
76 | - [x] 別の完了したタスク
77 | - [ ] ネストしたタスクリスト
78 | - [x] サブタスク1(完了)
79 | - [ ] サブタスク2(未完了)
80 | - [x] サブタスク3(完了)
81 |
82 | ### 定義リスト
83 |
84 | 用語1
85 | : これは用語1の定義です。
86 |
87 | 用語2
88 | : これは用語2の定義です。
89 | : 用語は複数の定義を持つことができます。
90 |
91 | ## コード
92 |
93 | ### インラインコード
94 |
95 | これは`console.log('Hello World')`を含む段落です。
96 |
97 | ### コードブロック
98 |
99 | ```javascript
100 | function greet(name) {
101 | console.log(`こんにちは、${name}!`);
102 | }
103 |
104 | greet('世界');
105 | ```
106 |
107 | ```python
108 | def fibonacci(n):
109 | if n <= 1:
110 | return n
111 | return fibonacci(n-1) + fibonacci(n-2)
112 |
113 | print(fibonacci(10))
114 | ```
115 |
116 | ```css
117 | .prose {
118 | max-width: none;
119 | color: var(--tw-prose-body);
120 | }
121 |
122 | .prose h1 {
123 | font-size: 2.25rem;
124 | font-weight: 700;
125 | }
126 | ```
127 |
128 | ## テーブル
129 |
130 | | 左揃え | 中央揃え | 右揃え |
131 | |:-------|:--------:|-------:|
132 | | 内容1 | 内容2 | 内容3 |
133 | | 長い内容 | 中程度 | 短い |
134 | | データA | データB | データC |
135 |
136 | ## 水平線
137 |
138 | ---
139 |
140 | ## 画像
141 |
142 | 
143 |
144 | ## リンク
145 |
146 | これは[通常のリンク](https://example.com)です。
147 |
148 | これは[タイトル付きのリンク](https://example.com "リンクタイトル")です。
149 |
150 | これは参照スタイルのリンクです:[参照リンク][1]
151 |
152 | [1]: https://example.com "参照リンクタイトル"
153 |
154 | ## 脚注
155 |
156 | これは脚注を含む段落です[^1]。
157 |
158 | これは別の脚注です[^note]。
159 |
160 | [^1]: これは最初の脚注の内容です。
161 |
162 | [^note]: これは名前付き脚注の内容です。
163 |
164 | ## ハイライトテキスト
165 |
166 | これは==ハイライトテキスト==を含む段落です。
167 |
168 | ## 上付き文字と下付き文字
169 |
170 | H~2~Oは水の化学式です。
171 |
172 | E = mc^2^はアインシュタインの質量エネルギー等価式です。
173 |
174 | ## キーボードキー
175 |
176 | テキストをコピーするにはCtrl + Cを押してください。
177 |
178 | ## 略語
179 |
180 | HTMLは*ハイパーテキストマークアップ言語*の略語です。
181 |
182 | *[HTML]: ハイパーテキストマークアップ言語
183 |
184 | ## 数式(KaTeXがサポートされている場合)
185 |
186 | インライン数式:$E = mc^2$
187 |
188 | ブロック数式:
189 |
190 | $$
191 | \int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}
192 | $$
193 |
194 | ## 警告(サポートされている場合)
195 |
196 | > [!NOTE]
197 | > これは注意事項です。
198 |
199 | > [!TIP]
200 | > これはヒントです。
201 |
202 | > [!IMPORTANT]
203 | > これは重要な情報です。
204 |
205 | > [!WARNING]
206 | > これは警告です。
207 |
208 | > [!CAUTION]
209 | > これは注意事項です。
210 |
211 | ## 詳細(サポートされている場合)
212 |
213 |
214 | 詳細を展開するにはクリック
215 |
216 | これは折りたたまれた詳細な内容です。
217 |
218 | ここには任意のMarkdown構文を含めることができます:
219 |
220 | - リスト項目
221 | - **太字テキスト**
222 | - `コード`
223 |
224 |
225 |
226 | ## 混合コンテンツテスト
227 |
228 | この段落には複数の形式が含まれています:**太字**、*斜体*、`コード`、[リンク](https://example.com)、~~取り消し線~~、==ハイライト==。
229 |
230 | ### 複雑なリスト
231 |
232 | 1. **太字**テキストを含む最初の項目
233 | - `コード`を含むネストした項目
234 | - [リンク](https://example.com)を含む別のネストした項目
235 | 2. *斜体*テキストを含む2番目の項目
236 | 1. 順序付きネストした項目
237 | 2. 別の順序付きネストした項目
238 | 3. ~~取り消し線~~テキストを含む3番目の項目
239 |
240 | ### 複雑なテーブル
241 |
242 | | 機能 | ステータス | 説明 |
243 | |------|:----------:|----|
244 | | **太字** | ✅ | 太字テキストをサポート |
245 | | *斜体* | ✅ | 斜体をサポート |
246 | | `コード` | ✅ | インラインコードをサポート |
247 | | [リンク](https://example.com) | ✅ | リンクをサポート |
248 | | ~~取り消し線~~ | ❌ | テストが必要 |
249 |
250 | このテストドキュメントは、最も一般的なMarkdown構文をカバーしており、プロススタイルの完全性と美観を検証するために使用できます。
251 |
--------------------------------------------------------------------------------
/layouts/_partials/ui/reading-progress.html:
--------------------------------------------------------------------------------
1 | {{/* 阅读进度条组件
2 |
3 | 功能:
4 | - 显示页面阅读进度
5 | - 根据滚动位置动态更新
6 | - 主题颜色适配
7 | - 可配置显示条件
8 | */}}
9 |
10 | {{- $enabled := site.Params.readingProgress.enabled | default true -}}
11 | {{- $showOnHomepage := site.Params.readingProgress.showOnHomepage | default false -}}
12 | {{- $height := site.Params.readingProgress.height | default 3 -}}
13 | {{- $smoothScroll := site.Params.readingProgress.smoothScroll | default true -}}
14 | {{- $hideOnComplete := site.Params.readingProgress.hideOnComplete | default false -}}
15 |
16 | {{/* 检查是否应该显示进度条 */}}
17 | {{- $shouldShow := false -}}
18 | {{- if $enabled -}}
19 | {{- if eq .Kind "home" -}}
20 | {{- $shouldShow = $showOnHomepage -}}
21 | {{- else -}}
22 | {{- $shouldShow = true -}}
23 | {{- end -}}
24 | {{- end -}}
25 |
26 | {{- if $shouldShow -}}
27 |
28 |
34 |
35 |
36 |
37 |
38 |
43 |
44 |
45 |
134 | {{- end -}}
135 |
--------------------------------------------------------------------------------
24 | {{ partial "features/icon.html" (dict "name" "message-circle" "size" "lg" "ariaLabel" "") }} 25 | {{ i18n "comments.title" | default "评论" }} 26 |
27 | 28 |49 | {{ i18n "comments.unsupported_system" | default "不支持的评论系统" }} 50 |
51 |52 | {{ i18n "comments.unsupported_system_desc" | default "请检查配置中的评论系统类型" }} 53 |
54 |55 | 当前配置: 56 | {{ $commentSystem }} 57 |
58 |