diff options
| author | yingyu5658 <i@yingyu5658.me> | 2025-12-29 21:19:05 +0800 |
|---|---|---|
| committer | yingyu5658 <i@yingyu5658.me> | 2025-12-29 21:19:05 +0800 |
| commit | 666022b097de6b18b5432b9fb59fd3aa39afe5e8 (patch) | |
| tree | 0e3e208c0d3337e9b9a3223b5d340a343dfd4a94 | |
| parent | 79e1ec9991d41a86d72a35b71b9f378efa176d0b (diff) | |
| download | blog-666022b097de6b18b5432b9fb59fd3aa39afe5e8.tar.gz blog-666022b097de6b18b5432b9fb59fd3aa39afe5e8.zip | |
feat: Add a switch of comments
| -rw-r--r-- | archetypes/default.md | 5 | ||||
| -rw-r--r-- | content/about.md | 3 | ||||
| -rw-r--r-- | content/archives.md | 2 | ||||
| -rw-r--r-- | content/categories.md | 3 | ||||
| -rw-r--r-- | content/links.md | 3 | ||||
| -rw-r--r-- | content/readings.md | 3 | ||||
| -rw-r--r-- | hugo.toml | 5 | ||||
| -rw-r--r-- | layouts/_default/single.html | 28 |
8 files changed, 27 insertions, 25 deletions
diff --git a/archetypes/default.md b/archetypes/default.md index 2f61dae..547bc04 100644 --- a/archetypes/default.md +++ b/archetypes/default.md @@ -1,10 +1,11 @@ --- -date: '{{ .Date }}' -draft: true title: '{{ replace .File.ContentBaseName "-" " " | title }}' +date: '{{ .Date }}' slug: '' categories: - tags: - +draft: true +comments: true --- diff --git a/content/about.md b/content/about.md index 9360d36..a709f27 100644 --- a/content/about.md +++ b/content/about.md @@ -1,7 +1,8 @@ --- date: 2025-02-26T20:31:14+08:00 title: 关于 -type: no-comments +comments: false +showMeta: false --- > 📌 如果想获得最新动态,可以加入本博客的Telegram频道[「🌊 央山常量池」](https://t.me/glowisle/),有博客选题、观察思考,还有我的碎碎念。 > diff --git a/content/archives.md b/content/archives.md index 8e8196d..de873df 100644 --- a/content/archives.md +++ b/content/archives.md @@ -1,4 +1,6 @@ --- title: "归档" type: "archives" +comments: false +showMeta: false --- diff --git a/content/categories.md b/content/categories.md index 2f6f19c..f486d99 100644 --- a/content/categories.md +++ b/content/categories.md @@ -1,7 +1,10 @@ --- type: no-comments title: 分类 +comments: false +showMeta: false --- + ### [💭 随笔](/categories/随笔) 记录事情 | 抒发观点 | 发表议论 diff --git a/content/links.md b/content/links.md index 9d0eddb..c14e271 100644 --- a/content/links.md +++ b/content/links.md @@ -1,7 +1,8 @@ --- date: "2025-06-07T13:08:07+08:00" title: 友人 -type: no-comments +comments: false +showMeta: false --- | Link | Description | | -------------------------------------------- | -------------------------------------------------- | diff --git a/content/readings.md b/content/readings.md index 6710650..174a6d1 100644 --- a/content/readings.md +++ b/content/readings.md @@ -1,7 +1,8 @@ --- date: "2025-06-07T13:08:07+08:00" title: 读书 -type: no-comments +comment: false +showMeta: false --- 这里记录着我读过的书,有时候写写书评或读后感,你可以在[读书](/categories/读书/)页面查看所有与书籍有关的文章。 @@ -54,7 +54,7 @@ unsafe = true description = "关于互联网、书籍、生活琐事以及那些一闪而过的念头。计算机技术 & 读书感悟 & 日常随笔。映屿(GlowIsle)" postSearch = false groupByYear = true - toc = true + toc = false showPostCount = true favicon = "/favicon.png" hideMadeWithLine = true @@ -63,3 +63,6 @@ unsafe = true [params.author] name = "五葉地錦" email = "i@glowisle.me" + + [params.footer] + content = "© 2024 - 2025 | Made with ❤️ by Verdant" diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 8c26440..8b8f326 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -4,7 +4,7 @@ <article class="h-entry"> <h1 class="post-title p-name"><a href="{{ .RelPermalink }}" style="color:#222222;">{{ .Title }}</a></h1> - +{{ if ne (.Params.showMeta | default true) false }} <div class="post-info"> <time class="post-date dt-published" datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}"> {{ .Date.Format "2006年1月2日" }} @@ -14,6 +14,7 @@ <a href="{{ $url }}" class="category-link">{{ . }}</a> {{ end }} </div> +{{ end }} <div class="e-content"> {{ .Content }} </div> @@ -135,6 +136,8 @@ {{ $tocEnabled := default .Site.Params.toc .Params.toc }} {{ if $tocEnabled }} <div class="toc">{{ partial "toc.html" . }}</div> {{ end }} + +{{ if .Params.comments }} <hr /> <details> <summary> @@ -182,26 +185,10 @@ - <script> - /* -src="https://giscus.app/client.js" - data-repo="yingyu5658/yingyu5658.github.io" - data-repo-id="R_kgDOOBetsA" - data-category="Announcements" - data-category-id="DIC_kwDOOBetsM4CoF_Z" - data-mapping="title" - data-strict="0" - data-reactions-enabled="1" - data-emit-metadata="0" - data-input-position="bottom" - data-theme="dark" - data-lang="zh-CN" - crossorigin="anonymous" - async> -*/ - function getInitialTheme() { +<script> +function getInitialTheme() { // 1. 优先检查 localStorage 中的用户偏好 if (typeof localStorage !== 'undefined' && localStorage.getItem('theme')) { return localStorage.getItem('theme'); @@ -235,6 +222,8 @@ giscusScript.async = true; document.getElementById('giscus-container').appendChild(giscusScript); + + document.addEventListener('DOMContentLoaded', function() { const form = document.getElementById('webmention-submit-form'); const submitBtn = document.getElementById('webmention-submit-btn'); @@ -295,3 +284,4 @@ document.addEventListener('DOMContentLoaded', function() { </script> {{ end }} +{{ end }} |
