PaperMod美化归档

主要就是修改归档页面为默认折叠显示,按年月展开 在 layouts\_default\archives.html 中添加 1 2 3 4 5 6 7 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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 {{/* layouts/_default/archives.html —— 年→月二级归档 · 默认全部折叠 · 标题在前 · MM-DD后缀 */}} {{define "main" }} <header class="page-header"> <h1>{{ .Title }}</h1> {{if .Description }}<div class="post-description">{{ .Description | markdownify }}</div>{{end }} </header> {{- $pages := where site.RegularPages "Type" "in" site.Params.mainSections }} {{if site.Params.ShowAllPagesInArchive }}{{ $pages := site.RegularPages }}{{ end }} {{- $monthMap := dict "January" "01" "February" "02" "March" "03" "April" "04" "May" "05" "June" "06" "July" "07" "August" "08" "September" "09" "October" "10" "November" "11" "December" "12" }} {{range $pages.GroupByPublishDate "2006" }} {{if ne .Key "0001" }} <section class="archive-year"> <!-- ★ 把所有 open 属性删掉 = 默认折叠 ★ --> <details> <summary class="archive-year-header" id="{{ .Key }}"> <span class="archive-toggle"></span> {{ .Key }} 年 <sup class="archive-count">{{ len .Pages }} 篇</sup> </summary> <div class="archive-year-content"> {{range .Pages.GroupByDate "January" }} {{- $monthNum := index $monthMap .Key }} {{- $monthID := printf "%s-%s" $.Key $monthNum }} <details> <summary class="archive-month-header" id="{{ $monthID }}"> <span class="archive-toggle"></span> {{ .Key }} <sup class="archive-count">{{ len .Pages }} 篇</sup> </summary> <div class="archive-posts"> {{range .Pages.ByPublishDate.Reverse }} {{if eq .Kind "page" }} <article class="archive-entry"> <h3 class="archive-entry-title entry-hint-parent"> <a href="{{ .Permalink }}">{{ .Title | markdownify }}</a> {{if .Draft }}<span class="entry-hint" title="Draft">[草稿]</span>{{end }} <span class="archive-date-postfix"> ・ {{ .PublishDate.Format "01-02" }} </span> </h3> <div class="archive-meta">{{partial "post_meta.html" . -}}</div> <a class="entry-link" aria-label="post link to {{ .Title }}" href="{{ .Permalink }}"></a> </article> {{end }} {{end }} </div> </details> {{end }} </div> </details> </section> {{end }} {{end }} <style> details summary { list-style: none; cursor: pointer; user-select: none; } details summary::-webkit-details-marker { display: none; } .archive-toggle { display: inline-block; width: 1.2em; font-size: 0.85em; margin-right: 0.3em; opacity: 0.8; transition: opacity 0.2s; } details>summary .archive-toggle::before { content: "▶"; } /* 折叠时右箭头 */ details[open]>summary .archive-toggle::before { content: "▼"; } /* 展开时下箭头 */ .archive-year-header { font-size: 1.9em; font-weight: 600; margin: 1.8em 0 0.4em; } .archive-month-header { font-size: 1.55em; font-weight: 600; margin: 1.2em 0 0.4em 1.5em; } .archive-year-content { margin-left: 1.5em; margin-top: -0.4em; } .archive-posts { margin: 0.6em 0 1.8em 3em; padding-left: 0.5em; } .archive-count { font-size: 0.75em; color: var(--secondary); margin-left: 0.5em; font-weight: 500; vertical-align: middle; opacity: 0.9; } .archive-entry-title { font-size: 1.25em !important; margin: 0 0 0.35em !important; font-weight: 600; display: flex; align-items: center; flex-wrap: wrap; gap: 0.8em; } .archive-entry+.archive-entry { margin-top: 1rem; } .archive-date-postfix { font-size: 0.9em; color: var(--secondary); font-weight: normal; opacity: 0.9; flex-shrink: 0; } summary:hover { color: var(--tertiary); } summary:hover .archive-toggle { opacity: 1; } </style> {{end }}

创建: 2025年11月21日 | 更新: 2025年12月04日 | 字数: 700字 | 阅读时长: 2分钟 | Beiyuan

PaperMod修改侧边目录

创建 <your_hugo_site>/layouts/partials/toc.html 覆盖,在其中粘贴如下代码 1 2 3 4 5 6 7 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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 {{- $headers := findRE "<h[1-6].*?>(.|\n])+?</h[1-6]>" .Content -}} {{- $has_headers := ge (len $headers) 1 -}} {{if $has_headers -}} <aside id="toc-container" class="toc-container wide"> <div class="toc"> <details {{if (.Param "TocOpen") }} open{{ end }}> <summary accesskey="c" title="(Alt + C)"> <span class="details">{{i18n "toc" | default "Table of Contents" }}</span> </summary> <div class="inner"> {{- $largest := 6 -}} {{range $headers -}} {{- $headerLevel := index (findRE "[1-6]" . 1) 0 -}} {{- $headerLevel := len (seq $headerLevel) -}} {{if lt $headerLevel $largest -}} {{- $largest = $headerLevel -}} {{end -}} {{end -}} {{- $firstHeaderLevel := len (seq (index (findRE "[1-6]" (index $headers 0) 1) 0)) -}} {{- $.Scratch.Set "bareul" slice -}} <ul> {{range seq (sub $firstHeaderLevel $largest) -}} <ul> {{- $.Scratch.Add "bareul" (sub (add $largest .) 1) -}} {{end -}} {{range $i, $header := $headers -}} {{- $headerLevel := index (findRE "[1-6]" . 1) 0 -}} {{- $headerLevel := len (seq $headerLevel) -}} {{/* get id="xyz" */}} {{- $id := index (findRE "(id=\"(.*?)\")" $header 9) 0 }} {{- /* strip id="" to leave xyz, no way to get regex capturing groups in hugo */ -}} {{- $cleanedID := replace (replace $id "id=\"" "") "\"" "" }} {{- $header := replaceRE "<h[1-6].*?>((.|\n])+?)</h[1-6]>" "$1" $header -}} {{if ne $i 0 -}} {{- $prevHeaderLevel := index (findRE "[1-6]" (index $headers (sub $i 1)) 1) 0 -}} {{- $prevHeaderLevel := len (seq $prevHeaderLevel) -}} {{if gt $headerLevel $prevHeaderLevel -}} {{range seq $prevHeaderLevel (sub $headerLevel 1) -}} <ul> {{/* the first should not be recorded */}} {{if ne $prevHeaderLevel . -}} {{- $.Scratch.Add "bareul" . -}} {{end -}} {{end -}} {{else -}} </li> {{if lt $headerLevel $prevHeaderLevel -}} {{range seq (sub $prevHeaderLevel 1) -1 $headerLevel -}} {{if in ($.Scratch.Get "bareul") . -}} </ul> {{/* manually do pop item */}} {{- $tmp := $.Scratch.Get "bareul" -}} {{- $.Scratch.Delete "bareul" -}} {{- $.Scratch.Set "bareul" slice}} {{range seq (sub (len $tmp) 1) -}} {{- $.Scratch.Add "bareul" (index $tmp (sub . 1)) -}} {{end -}} {{else -}} </ul> </li> {{end -}} {{end -}} {{end -}} {{end }} <li> <a href="#{{- $cleanedID -}}" aria-label="{{- $header | plainify -}}">{{- $header | safeHTML -}}</a> {{else }} <li> <a href="#{{- $cleanedID -}}" aria-label="{{- $header | plainify -}}">{{- $header | safeHTML -}}</a> {{end -}} {{end -}} <!-- {{- $firstHeaderLevel := len (seq (index (findRE "[1-6]" (index $headers 0) 1) 0)) -}} --> {{- $firstHeaderLevel := $largest }} {{- $lastHeaderLevel := len (seq (index (findRE "[1-6]" (index $headers (sub (len $headers) 1)) 1) 0)) }} </li> {{range seq (sub $lastHeaderLevel $firstHeaderLevel) -}} {{if in ($.Scratch.Get "bareul") (add . $firstHeaderLevel) }} </ul> {{else }} </ul> </li> {{end -}} {{end }} </ul> </div> </details> </div> </aside> <script> let activeElement; let elements; document.addEventListener('DOMContentLoaded', function (event) { checkTocPosition(); elements = document.querySelectorAll('h1[id],h2[id],h3[id],h4[id],h5[id],h6[id]'); if (elements.length > 0) { // Make the first header active activeElement = elements[0]; const id = encodeURI(activeElement.getAttribute('id')).toLowerCase(); document.querySelector(`.inner ul li a[href="#${id}"]`).classList.add('active'); } // Add event listener for the "back to top" link const topLink = document.getElementById('top-link'); if (topLink) { topLink.addEventListener('click', (event) => { // Prevent the default action event.preventDefault(); // Smooth scroll to the top window.scrollTo({ top: 0, behavior: 'smooth' }); }); } }, false); window.addEventListener('resize', function(event) { checkTocPosition(); }, false); window.addEventListener('scroll', () => { // Get the current scroll position const scrollPosition = window.pageYOffset || document.documentElement.scrollTop; // Check if the scroll position is at the top of the page if (scrollPosition === 0) { return; } // Ensure elements is a valid NodeList if (elements && elements.length > 0) { // Check if there is an object in the top half of the screen or keep the last item active activeElement = Array.from(elements).find((element) => { if ((getOffsetTop(element) - scrollPosition) > 0 && (getOffsetTop(element) - scrollPosition) < window.innerHeight / 2) { return element; } }) || activeElement; elements.forEach(element => { const id = encodeURI(element.getAttribute('id')).toLowerCase(); const tocLink = document.querySelector(`.inner ul li a[href="#${id}"]`); if (element === activeElement){ tocLink.classList.add('active'); // Ensure the active element is in view within the .inner container const tocContainer = document.querySelector('.toc .inner'); const linkOffsetTop = tocLink.offsetTop; const containerHeight = tocContainer.clientHeight; const linkHeight = tocLink.clientHeight; // Calculate the scroll position to center the active link const scrollPosition = linkOffsetTop - (containerHeight / 2) + (linkHeight / 2); tocContainer.scrollTo({ top: scrollPosition, behavior: 'smooth' }); } else { tocLink.classList.remove('active'); } }); } }, false); const main = parseInt(getComputedStyle(document.body).getPropertyValue('--article-width'), 10); const toc = parseInt(getComputedStyle(document.body).getPropertyValue('--toc-width'), 10); const gap = parseInt(getComputedStyle(document.body).getPropertyValue('--gap'), 10); function checkTocPosition() { const width = document.body.scrollWidth; if (width - main - (toc * 2) - (gap * 4) > 0) { document.getElementById("toc-container").classList.add("wide"); } else { document.getElementById("toc-container").classList.remove("wide"); } } function getOffsetTop(element) { if (!element.getClientRects().length) { return 0; } let rect = element.getBoundingClientRect(); let win = element.ownerDocument.defaultView; return rect.top + win.pageYOffset; } </script> {{end }} 创建 <your_hugo_site>/assets/css/extended/toc.css 文件,并拷贝以下内容 1 2 3 4 5 6 7 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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 :root { --nav-width: 1380px; --article-width: 650px; --toc-width: 300px; } .toc { margin: 0 2px 40px 2px; border: 1px solid var(--border); background: var(--entry); border-radius: var(--radius); padding: 0.4em; } .toc-container.wide { position: absolute; height: 100%; border-right: 1px solid var(--border); left: calc((var(--toc-width) + var(--gap)) * -1); top: calc(var(--gap) * 2); width: var(--toc-width); } .wide .toc { position: sticky; top: var(--gap); border: unset; background: unset; border-radius: unset; width: 100%; margin: 0 2px 40px 2px; } .toc details summary { cursor: zoom-in; margin-inline-start: 20px; padding: 12px 0; } .toc details[open] summary { font-weight: 500; } .toc-container.wide .toc .inner { margin: 0; } .active { font-size: 110%; font-weight: 600; } .toc ul { list-style-type: circle; } .toc .inner { margin: 0 0 0 20px; padding: 0px 15px 15px 20px; font-size: 16px; /*目录显示高度*/ max-height: 83vh; overflow-y: auto; } .toc .inner::-webkit-scrollbar-thumb { /*滚动条*/ background: var(--border); border: 7px solid var(--theme); border-radius: var(--radius); } .toc li ul { margin-inline-start: calc(var(--gap) * 0.5); list-style-type: none; } .toc li { list-style: none; font-size: 0.95rem; padding-bottom: 5px; } .toc li a:hover { color: var(--secondary); }

创建: 2025年11月04日 | 更新: 2025年12月04日 | 字数: 1263字 | 阅读时长: 3分钟 | Beiyuan

PaperMod自定义字体

1 . 在 layouts/partials/extend_head.html 中引入 CDN 1 2 3 <!-- 霞鹜字体 --> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/lxgw-wenkai-screen-web/style.css" /> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@callmebill/lxgw-wenkai-web@latest/style.css" /> 2 . 在 assets/css/extended/custome.css 中添加字体样式: 1 2 3 4 5 6 7 8 9 10 /* 正文字体 */ .post-content { font-family: LXGW WenKai Light, LXGW WenKai Screen, sans-serif; } body { font-size: 18px; line-height: 1.6; font-family: LXGW WenKai Light, LXGW WenKai Screen, sans-serif; } 3 . 在 assets/css/extended/admonition.css 处修改 admonition 注释框中的字体。 1 2 3 4 5 /* admonition注释框字体 */ body, .admonition { font-family: LXGW WenKai Light, LXGW WenKai Screen, sans-serif; }

创建: 2025年11月02日 | 更新: 2025年12月04日 | 字数: 129字 | 阅读时长: 1分钟 | Beiyuan

服务器部署Hugo

Github 安装 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 # 删除旧版 Hugo which hugo &>/dev/null && sudo rm -f $(which hugo) # 下载并安装最新版本的 Hugo curl -s https://api.github.com/repos/gohugoio/hugo/releases/latest \ | grep "browser_download_url" \ | grep -E "hugo_extended_.*Linux-64bit\.tar\.gz" \ | grep -vE "\.with" \ | cut -d '"' -f 4 | head -n 1 \ | xargs wget -O hugo.tar.gz && \ tar -xzf hugo.tar.gz && \ sudo mv hugo /usr/local/bin/ && \ rm -f hugo.tar.gz LICENSE* README.md # 固定版本 wget https://github.com/gohugoio/hugo/releases/download/v0.147.2/hugo_extended_0.147.2_Linux-64bit.tar.gz -O hugo.tar.gz && \ tar -xzf hugo.tar.gz && \ sudo mv hugo /usr/local/bin/ && \ rm -rf hugo.tar.gz LICENSE* README.md 安装主题 1 2 3 4 5 6 7 8 9 10 # 创建一个名为 blog 的新 Hugo 站点 hugo new site /opt/blog --format yaml # 进入站点目录 cd /opt/blog # 初始化 git 仓库(推荐,方便管理主题子模块) apt install git git init # 添加主题为子模块 git submodule add https://github.com/adityatelange/hugo-PaperMod.git themes/PaperMod git submodule update --remote --merge 默认配置示例 1 2 3 4 5 6 7 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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 baseURL: "https:example.com" # 网站的基础 URL,部署到子路径需调整此项 title: Beiyuan # 网站标题 theme: PaperMod # 使用的主题名称(已安装的主题文件夹名) languageCode: zh # 网站默认语言(中文) defaultContentLanguage: zh # 默认内容语言 hasCJKLanguage: true # 是否启用对中日韩语言优化(统计字数、阅读时间等更准确) pagination: pagerSize: 10 # 每页最多显示 10 篇文章 enableRobotsTXT: true # 启用 robots.txt 文件(搜索引擎爬虫指引) buildDrafts: false # 不构建草稿文章 buildFuture: false # 不构建发布日期在未来的文章 buildExpired: false # 不构建已过期的文章 minify: disableXML: true # 不压缩生成的 XML 文件 #minifyOutput: true # 压缩 HTML 输出 params: env: production # 环境变量,生产环境时可启用 GA、SEO 等 title: Beiyuan # 站点标题(与上面重复,但为主题使用) description: "Share" # 网站描述 keywords: [资源分享] # 关键词,SEO 使用 author: Beiyuan # 作者名称 DateFormat: "January 2, 2006" # 日期格式(文章时间显示格式) defaultTheme: auto # 默认主题:auto(跟随系统)、dark、light disableThemeToggle: false # 是否禁用切换明暗模式按钮 ShowReadingTime: true # 显示文章阅读时间 ShowPostNavLinks: true # 显示上一篇/下一篇导航链接 ShowBreadCrumbs: true # 显示面包屑导航 ShowCodeCopyButtons: false # 是否显示“复制代码”按钮 ShowWordCount: true # 显示文章字数 ShowRssButtonInSectionTermList: true # 在分类、标签页面显示 RSS 按钮 UseHugoToc: true # 使用 Hugo 内置目录而非主题自带目录 disableSpecial1stPost: false # 是否禁用首页首篇特殊展示样式 disableScrollToTop: false # 是否禁用回到顶部按钮 comments: false # 全局禁用评论 hidemeta: false # 是否隐藏 meta 信息(作者、时间等) hideSummary: false # 是否隐藏摘要 showtoc: false # 是否默认显示目录 tocopen: false # 是否默认展开目录 assets: # disableHLJS: true # 是否禁用 highlight.js(如果用的是 Chroma 可禁用) # disableFingerprinting: true # 是否禁用静态资源指纹(可选) favicon: "/favicon.ico" # 网站图标路径(放置在 static/ 下) favicon16x16: "/favicon-16x16.png" favicon32x32: "/favicon-32x32.png" apple_touch_icon: "/apple-touch-icon.png" safari_pinned_tab: "/favicon.ico" label: text: "Beiyuan" # 左上角 Logo 文字 icon: /apple-touch-icon.png # Logo 图标路径 iconHeight: 35 # Logo 高度 # 首页介绍卡片 homeInfoParams: Title: "Beiyuan Shares" # 首页介绍标题 Content: A place where I share the things I want to share # 首页介绍内容 cover: hidden: true # 是否在结构化数据中隐藏封面 hiddenInList: true # 是否在列表页隐藏封面图 hiddenInSingle: true # 是否在单页隐藏封面图 # 搜索相关配置(使用 Fuse.js 本地搜索) # Fuse.js 配置说明:https://fusejs.io/api/options.html fuseOpts: isCaseSensitive: false shouldSort: true location: 0 distance: 1000 threshold: 0.4 minMatchCharLength: 0 limit: 10 keys: ["title", "permalink", "summary", "content"] menu: main: - identifier: archives # 归档页面菜单项 name: 归档 url: /archives/ weight: 10 - identifier: tags # 标签页面菜单项 name: 标签 url: /tags/ weight: 20 - identifier: search # 搜索页面菜单项 name: 搜索 url: /search/ weight: 30 # 使用 Hugo 的语法高亮器(Chroma) # 更多配色方案见:https://xyproto.github.io/splash/docs/all.html pygmentsUseClasses: true # 使用 CSS 类进行高亮(建议开启,便于主题样式控制) markup: highlight: noClasses: false # 使用 CSS 类而非内联样式(false 推荐) # anchorLineNos: true # 是否为每一行添加锚点(方便链接到指定代码行) # codeFences: true # 启用 ``` 代码块支持(建议开启) # guessSyntax: true # 启用语言猜测(不指定语言时尝试自动识别) # lineNos: true # 显示代码行号 # style: monokai # 设置代码高亮风格,如:monokai、dracula、github、solarized 等 默认文章头示例 1 2 3 4 5 6 7 8 9 10 11 12 13 --- auther: Beiyuan author: Beiyuan categories: - 自建折腾 date: '2025-05-06T14:26:29' draft: false lastmod: '2025-05-06T14:26:29' tags: - Tools title: 服务器部署Hugo --- 创建文章并启动 1 2 3 4 #创建新文章 hugo new posts/my-new-post.md #启动,创建完成后就和hugo脱离了,hugo只需要写文章build就行了 hugo --environment production --minify --cleanDestinationDir Nginx反代 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 #安装所需程序 sudo apt install certbot python3-certbot-nginx python3-certbot-dns-cloudflare nginx #手动编辑 sudo nano /etc/nginx/sites-available/hugo #启用配置 sudo ln -s /etc/nginx/sites-available/hugo /etc/nginx/sites-enabled/ #从Cloudflare获取区域DNS API sudo nano /etc/letsencrypt/cloudflare.ini dns_cloudflare_api_token = 你的API #赋予权限 sudo chmod 600 /etc/letsencrypt/cloudflare.ini #使用CF-DNS申请证书,你不想关小黄云用这个,全程y就行 sudo certbot certonly --dns-cloudflare --dns-cloudflare-credentials /etc/letsencrypt/cloudflare.ini -d example.com #替换为你的域名 #直接申请证书,上面的申请完后可以用这个命令自动配置HTTPS,选1 sudo certbot --nginx -d example.com #替换为你的域名 #这里是把hugo生成的public软链接到nginx目录 sudo ln -s /opt/blog/public /var/www/html/hugo 1 2 3 4 5 6 7 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 37 38 39 40 41 42 43 44 45 46 47 48 server { listen 80; listen [::]:80; server_name example.com; # 替换为您的域名或 IP 地址 root /var/www/html/hugo; # Hugo 网站的 public 目录路径 (确保这个路径存在并指向 Hugo 的输出目录) index index.html; # Hugo 路由兼容(archives、tags 等路径支持) location / { try_files $uri $uri/ /index.html; } # 启用 gzip 压缩 gzip on; gzip_vary on; gzip_min_length 1024; gzip_proxied any; gzip_comp_level 6; gzip_types text/plain text/css text/xml application/json application/javascript application/rss+xml application/atom+xml image/svg+xml; # 缓存静态资源 location ~* \.(?:css|js|jpg|jpeg|gif|png|ico|svg|woff2?|ttf|eot|otf|json|webp)$ { expires 30d; access_log off; add_header Cache-Control "public"; } # 强化安全头部 add_header X-Frame-Options "SAMEORIGIN" always; add_header X-Content-Type-Options "nosniff" always; add_header X-XSS-Protection "1; mode=block" always; add_header Referrer-Policy "strict-origin-when-cross-origin" always; add_header Permissions-Policy "geolocation=(), microphone=(), camera=()" always; # 拒绝访问隐藏文件(如 .git) location ~ /\. { deny all; } } 启用归档和搜索 1 2 3 cd /opt/blog/content nano archives.md nano search.md 1 2 3 4 5 6 7 8 9 10 11 12 13 --- auther: Beiyuan author: Beiyuan categories: - 自建折腾 date: '2025-05-06T14:26:29' draft: false lastmod: '2025-05-06T14:26:29' tags: - Tools title: 服务器部署Hugo --- 1 2 3 4 5 6 7 8 9 10 11 12 13 --- auther: Beiyuan author: Beiyuan categories: - 自建折腾 date: '2025-05-06T14:26:29' draft: false lastmod: '2025-05-06T14:26:29' tags: - Tools title: 服务器部署Hugo --- 标签分类和文章页面修改中文 要将标签和分类等页面改为中文需要在对应文件夹下添加 _index.md 文件。 ...

创建: 2025年09月03日 | 更新: 2025年12月04日 | 字数: 2261字 | 阅读时长: 5分钟 | Beiyuan

PaperMod启用评论

1. 创建仓库 该仓库是公开的,否则访客将无法查看 Discussion 2 启用讨论 (1)单击设置 (2)向下滚动到 Features 部分 –> 勾选讨论 –> 点击 Set up Discussions (3)滚动到下方,点击 Start discussions ...

创建: 2025年05月15日 | 更新: 2025年12月04日 | 字数: 1104字 | 阅读时长: 3分钟 | Beiyuan