This commit is contained in:
谢宇宁
2026-09-24 12:42:30 +07:00
parent e14b3863fb
commit 613db5cb79
15 changed files with 758 additions and 660 deletions
+8 -4
View File
@@ -17,7 +17,7 @@
{{if .jsonLD}}
<script type="application/ld+json">{{.jsonLD}}</script>
{{end}}
<link rel="stylesheet" href="/static/css/index.css?v=38">
<link rel="stylesheet" href="/static/css/index.css?v=39">
{{/* PC 需要 Swiper 样式;H5 延后按需注入,避免首屏下载与强制重排 */}}
<link rel="stylesheet" href="/static/common/swiper-bundle.min.css" media="(min-width: 768px)">
<link rel="preload" href="/static/common/swiper-bundle.min.js" as="script" media="(min-width: 768px)">
@@ -73,7 +73,8 @@
</div>
{{end}}
{{if .announcements}}
{{$cfg := .appConfig}}
{{if or .announcements $cfg.ForeverURLAddr $cfg.NewURLAddr $cfg.NewURLAddr1}}
<div class="home-announcement" role="note" aria-label="站内公告">
<div class="home-announcement-label">
<picture>
@@ -83,8 +84,8 @@
</div>
<div class="home-announcement-content">
<div class="home-announcement-marquee">
<span class="home-announcement-copy">{{range $i, $announcement := .announcements}}{{if $i}}<span class="home-announcement-separator" aria-hidden="true"> · </span>{{end}}{{if $announcement.Title}}<span class="home-announcement-title">{{$announcement.Title}}</span>{{if $announcement.Content}}:{{end}}{{end}}{{$announcement.Content}}{{end}}</span>
<span class="home-announcement-copy" aria-hidden="true">{{range $i, $announcement := .announcements}}{{if $i}}<span class="home-announcement-separator"> · </span>{{end}}{{if $announcement.Title}}<span class="home-announcement-title">{{$announcement.Title}}</span>{{if $announcement.Content}}:{{end}}{{end}}{{$announcement.Content}}{{end}}</span>
<span class="home-announcement-copy">{{template "homeAnnouncementItems" .}}</span>
<span class="home-announcement-copy" aria-hidden="true">{{template "homeAnnouncementItems" .}}</span>
</div>
</div>
</div>
@@ -210,3 +211,6 @@
</body>
</html>
{{/* 跑马灯内容:后台公告在前,随后是官方访问地址 */}}
{{define "homeAnnouncementItems"}}{{$cfg := .appConfig}}{{$n := 0}}{{range .announcements}}{{if $n}}<span class="home-announcement-separator" aria-hidden="true"> · </span>{{end}}{{$n = 1}}{{if .Title}}<span class="home-announcement-title">{{.Title}}</span>{{if .Content}}:{{end}}{{end}}{{.Content}}{{end}}{{if $cfg.ForeverURLAddr}}{{if $n}}<span class="home-announcement-separator" aria-hidden="true"> · </span>{{end}}{{$n = 1}}<span class="home-announcement-title">海外永久地址</span>:<a class="home-announcement-link" href="{{$cfg.ForeverURLAddr}}" target="_blank" rel="sponsored nofollow noopener noreferrer">{{$cfg.ForeverURLAddr}}</a>{{end}}{{if $cfg.NewURLAddr}}{{if $n}}<span class="home-announcement-separator" aria-hidden="true"> · </span>{{end}}{{$n = 1}}<span class="home-announcement-title">最新地址</span>:<a class="home-announcement-link" href="{{$cfg.NewURLAddr}}" target="_blank" rel="sponsored nofollow noopener noreferrer">{{$cfg.NewURLAddr}}</a>{{end}}{{if $cfg.NewURLAddr1}}{{if $n}}<span class="home-announcement-separator" aria-hidden="true"> · </span>{{end}}{{$n = 1}}<span class="home-announcement-title">备用地址</span>:<a class="home-announcement-link" href="{{$cfg.NewURLAddr1}}" target="_blank" rel="sponsored nofollow noopener noreferrer">{{$cfg.NewURLAddr1}}</a>{{end}}<span class="home-announcement-separator" aria-hidden="true"> · </span>请收藏以上地址,防止迷路{{end}}