- 邮件模板重做成微信聊天式:灰底、自己评论绿色气泡靠右、对方白色气泡靠左、 40px 圆角方头像(weavatar,邮箱 md5 不外泄)、时间居中、#07C160 主按钮; 布局全嵌套表格(Outlook 稳),表情内联 max-height:28px(修掉「表情太大」)、 配图限宽 100%;管理员主题从「新的评论待审」改成「您有一个新的评论」 - 老友自动填充:新增 /comments/lookup(只回昵称+网址,绝不含邮箱;IP 限速 30 次/10 分钟)+ 主题 comment-autofill 模块(填昵称弹提示、填邮箱自动带出 上次的昵称/网址,事件委托不怕 Artalk 重建编辑器) - CF 后台新增「国内线路」一键跳:/editor/handoff 用共享令牌对时间戳 HMAC 签名 → editor-api /admin/handoff 验签发会话 Cookie(2 分钟有效、防重放), 晚高峰丢包时直达国内机后台免重新登录
184 lines
8.0 KiB
HTML
184 lines
8.0 KiB
HTML
<div class="footer">
|
||
<nav class="nav" style="clear: both;">
|
||
© 2019 - {{ now.Year }}
|
||
<br>
|
||
<a href="https://beian.miit.gov.cn/" target="_blank"><span style="color:#999999;">鄂ICP备2022015735号-1</span></a>
|
||
<br>
|
||
本站由<a href="https://www.upyun.com/?utm_source=lianmeng&utm_medium=referral" target="blank" title="又拍云"
|
||
style="display:inline-block;text-decoration:none;height:20px;line-height:20px;">
|
||
<span style="color: var(--contentColor);font-weight: 700;">又拍云CDN</span>
|
||
</a>提供CDN加速服务
|
||
<br>
|
||
</nav>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="floating-tools">
|
||
<a href="javascript:;" id="search-btn" title="搜索文章">
|
||
<i class="ri-search-line"></i>
|
||
</a>
|
||
<a href="javascript:;" id="theme-toggle" title="切换主题">
|
||
<i class="ri-sun-line"></i>
|
||
</a>
|
||
<a href="#Comments" id="to-comments" title="跳转评论">
|
||
<i class="ri-chat-2-line"></i>
|
||
</a>
|
||
<a href="#" id="back-to-top" title="返回顶部">
|
||
<i class="ri-arrow-up-line"></i>
|
||
</a>
|
||
</div>
|
||
|
||
<!-- Search Modal -->
|
||
<div id="search-modal" class="search-modal">
|
||
<div class="search-modal-content">
|
||
<div class="search-header">
|
||
<h3>搜索文章</h3>
|
||
<span class="close-search">×</span>
|
||
</div>
|
||
<div class="search-body">
|
||
<div class="search-input-wrapper">
|
||
<input type="text" id="search-input" placeholder="输入关键词搜索..." autocomplete="off">
|
||
<button id="search-submit"><i class="ri-search-line"></i></button>
|
||
</div>
|
||
<div id="search-results" class="search-results">
|
||
<!-- Search results will appear here -->
|
||
<p class="search-tip">输入关键词并回车进行搜索</p>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
{{/* ====== 优化后的JS加载策略(方案1:保守优化) ====== */}}
|
||
|
||
{{/* ====== 1. 核心JS Bundle - 始终加载 ====== */}}
|
||
{{ $iconfont := resources.Get "js/libs/iconfont.js" }}
|
||
{{ $uikit := resources.Get "js/libs/uikit.min.js" }}
|
||
{{ $viewimage := resources.Get "js/libs/view-image.min.js" }}
|
||
{{/* Message.js(Qmsg)+ Toast 适配层放在 utils 之前,保证任何 toast 调用点执行时组件已就绪 */}}
|
||
{{ $message := resources.Get "js/libs/message.min.js" }}
|
||
{{ $toast := resources.Get "js/modules/toast.js" }}
|
||
{{ $utils := resources.Get "js/modules/utils.js" }}
|
||
{{ $loader := resources.Get "js/modules/loader.js" }}
|
||
{{ $cache := resources.Get "js/modules/cache.js" }}
|
||
{{ $search := resources.Get "js/modules/search.js" }}
|
||
{{ $floatingTools := resources.Get "js/modules/floating-tools.js" }}
|
||
{{ $nprogress := resources.Get "js/libs/nprogress.js" }}
|
||
{{ $pjaxLib := resources.Get "js/libs/pjax.js" }}
|
||
{{ $mypjax := resources.Get "js/modules/mypjax.js" }}
|
||
{{ $pangu := resources.Get "js/modules/pangu.js" }}
|
||
{{ $linkify := resources.Get "js/modules/linkify.js" }}
|
||
{{ $shortcodesJs := resources.Get "js/shortcodes.js" }}
|
||
{{ $lazyload := resources.Get "js/modules/lazyload.js" }}
|
||
{{ $main := resources.Get "js/main.js" }}
|
||
|
||
{{ $coreScripts := slice $iconfont $uikit $viewimage $message $toast $utils $loader $cache $search $floatingTools $nprogress $pjaxLib $mypjax $pangu $linkify $shortcodesJs $lazyload $main | resources.Concat "js/core.js" | resources.Minify | resources.Fingerprint }}
|
||
|
||
<script defer src="{{ $coreScripts.RelPermalink }}"></script>
|
||
|
||
{{/* ====== 2. 配置变量 ====== */}}
|
||
<script>
|
||
window.enableInfiniteScroll = {{ .Site.Params.infiniteScroll.enable | default false }};
|
||
</script>
|
||
|
||
{{/* ====== 3. 友链 / 友圈数据 —— 构建期快照,模板**不发网络请求** ====== */}}
|
||
{{/* ★ 这里以前是 resources.GetRemote。它是在「每个页面的模板渲染过程中」同步发请求的,
|
||
而 footer 每页都要走一遍:构建节点(国内)到 api.200181.xyz(Cloudflare)一抖动,
|
||
两个拉取就会重试到撞穿 Hugo 的 partial 30 秒超时 → 整站构建失败、站点不更新
|
||
(2026-10-04 实测:WARN Links API fetch failed ... i/o timeout →
|
||
ERROR render of "home" failed: partial "footer.html" timed out after 30s)。
|
||
现在改为读 data/ 下的本地快照,由流水线 stage 里的 scripts/fetch_snapshots.sh
|
||
curl 落盘(见 .cnb.yml「Hugo 构建」)。快照缺失(本地预览 / 拉取失败)时
|
||
with 判空 → 渲染空数组,最坏只是评论区少了「友链 / 友圈」徽章,构建立马过。 */}}
|
||
{{ $linkHosts := slice }}
|
||
{{ $linkNames := slice }}
|
||
{{ with site.Data.friend_links }}
|
||
{{ range .links }}
|
||
{{ $host := "" }}
|
||
{{ with .url | urls.Parse }}
|
||
{{ $host = .Host | strings.TrimPrefix "www." }}
|
||
{{ end }}
|
||
{{ $title := .name | default "" }}
|
||
{{ if $host }}
|
||
{{ $linkHosts = $linkHosts | append (dict "host" $host "title" $title) }}
|
||
{{ end }}
|
||
{{ if $title }}
|
||
{{ $linkNames = $linkNames | append (dict "lower" (lower $title) "title" $title) }}
|
||
{{ end }}
|
||
{{ end }}
|
||
{{ end }}
|
||
<script>
|
||
window.friendLinks = {{ dict "hosts" $linkHosts "names" $linkNames | jsonify | safeJS }};
|
||
</script>
|
||
|
||
{{ $feedHosts := slice }}
|
||
{{ $feedNames := slice }}
|
||
{{ with site.Data.friend_feeds }}
|
||
{{ range .feeds }}
|
||
{{ $host := "" }}
|
||
{{ with .url | urls.Parse }}
|
||
{{ $host = .Host | strings.TrimPrefix "www." }}
|
||
{{ end }}
|
||
{{ $title := .feedTitle | default "" }}
|
||
{{ if $host }}
|
||
{{ $feedHosts = $feedHosts | append (dict "host" $host "title" $title) }}
|
||
{{ end }}
|
||
{{ if $title }}
|
||
{{ $feedNames = $feedNames | append (dict "lower" (lower $title) "title" $title) }}
|
||
{{ end }}
|
||
{{ end }}
|
||
{{ end }}
|
||
<script>
|
||
window.friendFeeds = {{ dict "hosts" $feedHosts "names" $feedNames | jsonify | safeJS }};
|
||
</script>
|
||
|
||
{{/* ====== 4. 页面特定JS - 按需加载 ====== */}}
|
||
|
||
{{/* 文章详情页专用JS */}}
|
||
{{ if .IsPage }}
|
||
{{/* 友链申请弹窗放最前:artalk.js 渲染申请卡片时会调 window.flApplyOpenModal */}}
|
||
{{ $friendlink := resources.Get "js/modules/friendlink.js" }}
|
||
{{ $artalkModule := resources.Get "js/modules/artalk.js" }}
|
||
{{/* 人机验证控件(Turnstile 风格),文章页与留言页共用 */}}
|
||
{{ $human := resources.Get "js/modules/human.js" }}
|
||
{{ $paragraphComments := resources.Get "js/modules/paragraph-comments.js" }}
|
||
{{ $reward := resources.Get "js/modules/reward.js" }}
|
||
{{/* 老朋友自动填充:填邮箱带出上次的昵称/网址 */}}
|
||
{{ $autofill := resources.Get "js/modules/comment-autofill.js" }}
|
||
|
||
{{ $pageScripts := slice $friendlink $autofill $artalkModule $human $paragraphComments $reward | resources.Concat "js/page-only.js" | resources.Minify | resources.Fingerprint }}
|
||
|
||
<script defer src="{{ $pageScripts.RelPermalink }}"></script>
|
||
<script>window._pageOnlyScriptUrl = '{{ $pageScripts.RelPermalink }}';</script>
|
||
{{ else }}
|
||
{{/* 非文章页面:仍然计算URL,但不加载,用于PJAX动态加载 */}}
|
||
{{ $friendlink := resources.Get "js/modules/friendlink.js" }}
|
||
{{ $artalkModule := resources.Get "js/modules/artalk.js" }}
|
||
{{/* 人机验证控件(Turnstile 风格),文章页与留言页共用 */}}
|
||
{{ $human := resources.Get "js/modules/human.js" }}
|
||
{{ $paragraphComments := resources.Get "js/modules/paragraph-comments.js" }}
|
||
{{ $reward := resources.Get "js/modules/reward.js" }}
|
||
{{ $autofill := resources.Get "js/modules/comment-autofill.js" }}
|
||
|
||
{{ $pageScripts := slice $friendlink $autofill $artalkModule $human $paragraphComments $reward | resources.Concat "js/page-only.js" | resources.Minify | resources.Fingerprint }}
|
||
|
||
<script>window._pageOnlyScriptUrl = '{{ $pageScripts.RelPermalink }}';</script>
|
||
{{ end }}
|
||
|
||
{{/* 首页专用JS */}}
|
||
{{ if .IsHome }}
|
||
{{ if .Site.Params.infiniteScroll.enable }}
|
||
{{ $infiniteScroll := resources.Get "js/modules/infinite-scroll.js" }}
|
||
<script defer src="{{ $infiniteScroll.RelPermalink }}"></script>
|
||
{{ end }}
|
||
{{ end }}
|
||
|
||
{{/* 特定页面专用JS */}}
|
||
{{ if or (eq .Type "links") (eq .Type "circles") }}
|
||
{{ $tiaozhuan := resources.Get "js/modules/tiaozhuan.js" }}
|
||
<script defer src="{{ $tiaozhuan.RelPermalink }}"></script>
|
||
{{ end }}
|
||
|
||
{{/* ====== 5. 第三方脚本 ====== */}}
|
||
<script async src="/js/bsz.js"></script>
|
||
</body>
|
||
|
||
</html> |