diff options
Diffstat (limited to 'layouts')
| -rw-r--r-- | layouts/partials/style.html | 15 | ||||
| -rw-r--r-- | layouts/shortcodes/music.html | 37 | ||||
| -rw-r--r-- | layouts/weekly/rss.xml | 85 |
3 files changed, 130 insertions, 7 deletions
diff --git a/layouts/partials/style.html b/layouts/partials/style.html index 8828dbd..d49bf2c 100644 --- a/layouts/partials/style.html +++ b/layouts/partials/style.html @@ -30,6 +30,14 @@ 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); } + nav a, + h1.post-title a, + .category-link, + .blog-posts li a { + text-decoration: none !important; + } + + nav a:hover, .post-title a:hover, a.item-link:hover, .blog-posts a:hover { @@ -304,13 +312,6 @@ border: 1px solid #414141 !important; } - nav a, - h1.post-title a, - .category-link, - .blog-posts li a { - text-decoration: none !important; - } - a { font-weight: 500 !important; } diff --git a/layouts/shortcodes/music.html b/layouts/shortcodes/music.html new file mode 100644 index 0000000..583b0b0 --- /dev/null +++ b/layouts/shortcodes/music.html @@ -0,0 +1,37 @@ +<!-- 这里的代码来自 https://github.com/BigCoke233/geek-death-project/blob/master/layouts/_shortcodes/music.html --> +<!-- 为了适配需求,我做了部分修改 --> +<div class="music-card"> + <!-- Cover, title, artist --> + <div class="music-info"> + <img class="music-cover" + src="{{ .Get "cover" }}" loading="lazy" alt="Cover" /> + <div class="music-text"> + <h4 class="music-title">{{ .Get "title" }}</h4> + <p class="music-artist">{{ .Get "artist" }}</p> + </div> + </div> + + <!-- Links --> + <div class="music-links"> + {{ with .Get "apple" }} + <a href="{{ . }}" class="music-btn" target="_blank" title="在 Apple Music 中打开" data-tooltip> + <img src="/images/apple-music.png" loading="lazy" class="music-icon" alt="Apple Music" /> + <span class="music-btn-text">Apple Music</span> + </a> + {{ end }} + + {{ with .Get "netease" }} + <a href="{{ . }}" class="music-btn" target="_blank" title="在网易云音乐中打开" data-tooltip> + <img src="/images/netease-music.png" loading="lazy" class="music-icon" alt="Netease Music" /> + <span class="music-btn-text">网易云</span> + </a> + {{ end }} + + {{ with .Get "spotify" }} + <a href="{{ . }}" class="music-btn" target="_blank" title="在 Spotify 中打开" data-tooltip> + <img src="/images/spotify.png" loading="lazy" class="music-icon" alt="Spotify" /> + <span class="music-btn-text">Spotify</span> + </a> + {{ end }} + </div> +</div> diff --git a/layouts/weekly/rss.xml b/layouts/weekly/rss.xml new file mode 100644 index 0000000..8550683 --- /dev/null +++ b/layouts/weekly/rss.xml @@ -0,0 +1,85 @@ +{{- /* Deprecate site.Author.email in favor of site.Params.author.email */}} +{{- $authorEmail := "" }} +{{- with site.Params.author }} + {{- if reflect.IsMap . }} + {{- with .email }} + {{- $authorEmail = . }} + {{- end }} + {{- end }} +{{- else }} + {{- with site.Author.email }} + {{- $authorEmail = . }} + {{- warnf "The author key in site configuration is deprecated. Use params.author.email instead." }} + {{- end }} +{{- end }} + +{{- /* Deprecate site.Author.name in favor of site.Params.author.name */}} +{{- $authorName := "" }} +{{- with site.Params.author }} + {{- if reflect.IsMap . }} + {{- with .name }} + {{- $authorName = . }} + {{- end }} + {{- else }} + {{- $authorName = . }} + {{- end }} +{{- else }} + {{- with site.Author.name }} + {{- $authorName = . }} + {{- warnf "The author key in site configuration is deprecated. Use params.author.name instead." }} + {{- end }} +{{- end }} + +{{- $pctx := . }} +{{- if .IsHome }}{{ $pctx = .Site }}{{ end }} +{{- $pages := slice }} +{{- if or $.IsHome $.IsSection }} +{{- $pages = $pctx.RegularPages }} +{{- else }} +{{- $pages = $pctx.Pages }} +{{- end }} +{{- $limit := .Site.Params.RSS.pageLimit }} +{{- if ge $limit 1 }} +{{- $pages = $pages | first $limit }} +{{- end }} +{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }} +<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> + <channel> + <title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} on {{ end }}{{ .Site.Title }}{{ end }}</title> + <link>{{ .Permalink }}</link> + <description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{ . }} {{ end }}{{ end }}on {{ .Site.Title }}</description> + <generator>Hugo</generator> + <language>{{ site.LanguageCode }}</language> + {{ with $authorEmail }} + <managingEditor>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</managingEditor> + {{ end }} + {{ with $authorEmail }} + <webMaster>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</webMaster> + {{ end }} + {{ with .Site.Params.copyright }} + <copyright>{{ . }}</copyright> + {{ end }} + {{ if not .Date.IsZero }} + <lastBuildDate>{{ (index $pages.ByLastmod.Reverse 0).Lastmod.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate> + {{ end }} + {{ if and .Site.Params.RSS.followFeedId .Site.Params.RSS.followUserId }} + <follow_challenge> + <feedId>{{ .Site.Params.RSS.followFeedId }}</feedId> + <userId>{{ .Site.Params.RSS.followUserId }}</userId> + </follow_challenge> + {{ end }} + {{- with .OutputFormats.Get "RSS" }} + {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }} + {{- end }} + {{- range $pages }} + <item> + <title>{{ .Title }}</title> + <link>{{ .Permalink }}</link> + <pubDate>{{ .PublishDate.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> + {{- with $authorEmail }}<author>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</author>{{ end }} + <guid>{{ .Permalink }}</guid> + <description>{{ .Content | transform.XMLEscape | safeHTML }}</description> + </item> + {{- end }} + </channel> +</rss> |
