diff --git a/README.md b/README.md index b071761..5fbc875 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,17 @@ ![image](https://user-images.githubusercontent.com/5889006/190859441-141b5f81-8483-40d2-bd96-ebf85616a46d.png) -# Hugo Theme Stack +# 此项目为二次修改后的主题,为我的博客而用。 -logo +你可以前往我的博客预览: -Card-style Hugo theme designed for bloggers. +[我的博客](https://blog.sakurasen.cn) -## Quickstart +# 注意 -Use this template: [CaiJimmy/hugo-theme-stack-starter](https://github.com/CaiJimmy/hugo-theme-stack-starter) +如果你要自己使用,请修改以下文件: -## Demo +data/external.yaml -* Starter template demo: [demo.stack.jimmycai.com](https://demo.stack.jimmycai.com) -* Dev build: [dev.stack.jimmycai.com](https://dev.stack.jimmycai.com) +layouts/partials/head/custom.html -## Documentation -Visit [stack.jimmycai.com](https://stack.jimmycai.com) - -## Copyright - -**Licensed under the GNU General Public License v3.0** - -Please do not remove the "*Theme Stack designed by Jimmy*" text and link. - -If you want to port this theme to another blogging platform, please let me know🙏. diff --git a/assets/icons/brand-bilibili.svg b/assets/icons/brand-bilibili.svg new file mode 100644 index 0000000..bef4baf --- /dev/null +++ b/assets/icons/brand-bilibili.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/icons/brand-netease-music.svg b/assets/icons/brand-netease-music.svg new file mode 100644 index 0000000..3d2da67 --- /dev/null +++ b/assets/icons/brand-netease-music.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/icons/brand-qq.svg b/assets/icons/brand-qq.svg new file mode 100644 index 0000000..b7d7481 --- /dev/null +++ b/assets/icons/brand-qq.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/icons/brand-steam.svg b/assets/icons/brand-steam.svg new file mode 100644 index 0000000..1cda320 --- /dev/null +++ b/assets/icons/brand-steam.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/icons/code-header.svg b/assets/icons/code-header.svg new file mode 100644 index 0000000..f40dd97 --- /dev/null +++ b/assets/icons/code-header.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/icons/edit.svg b/assets/icons/edit.svg new file mode 100644 index 0000000..06932db --- /dev/null +++ b/assets/icons/edit.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/icons/file-description.svg b/assets/icons/file-description.svg new file mode 100644 index 0000000..c56b297 --- /dev/null +++ b/assets/icons/file-description.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/icons/moon.svg b/assets/icons/moon.svg new file mode 100644 index 0000000..0af5771 --- /dev/null +++ b/assets/icons/moon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/icons/sun.svg b/assets/icons/sun.svg new file mode 100644 index 0000000..761fd34 --- /dev/null +++ b/assets/icons/sun.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/scss/custom.scss b/assets/scss/custom.scss index 61fa80f..18be548 100644 --- a/assets/scss/custom.scss +++ b/assets/scss/custom.scss @@ -1 +1,82 @@ -/* Place your custom SCSS in HUGO_SITE_FOLDER/assets/scss/custom.scss */ \ No newline at end of file +.archives-group { + margin-top: 2em; +} + +.article-list--compact { + align-items: center; + --image-size: 75px; + display: inline-flex; + flex-wrap: wrap; +} + +.article-list--compact img { + margin-left: 10px; + border-radius: 10px; + box-shadow: 0 0 0.3em; +} +.article-list--compact article>a { + gap: 0; + padding: 2em; +} + +.article-list--compact article:not(:last-of-type) { + border-bottom: none; + justify-content: space-between; +} + +.article-description { + padding: 0; + margin: 0; + font-size: 15px; +} + +@media (min-width: 1024px) { + + .article-list--compact.links { + display: grid; + grid-template-columns: 1fr 1fr; + background: none; + box-shadow: none; + + article { + background: var(--card-background); + border: none; + box-shadow: var(--shadow-l2); + margin-bottom: 8px; + border-radius: 10px; + + &:nth-child(odd) { + margin-right: 8px; + } + } + } +} + +.article-time>div, +.article-translations>div { + gap: 5px; +} + +.totalcount { + color: var(--card-text-color-secondary); + font-weight: normal; + margin-bottom: 5px; +} +.article-content .highlight { + background-color: #282c34; +} +// 文章页字体 +body, .article-content { + font-family: 'Noto Serif SC', serif; +} + +// 标题字体 +body, .article-title { + font-family: 'Noto Serif SC', serif; +} + + +// 首页字体 +body, .article-page { + font-family: 'Noto Serif SC', serif; +} \ No newline at end of file diff --git a/assets/scss/partials/layout/article.scss b/assets/scss/partials/layout/article.scss index 10e2706..b1f824d 100644 --- a/assets/scss/partials/layout/article.scss +++ b/assets/scss/partials/layout/article.scss @@ -458,4 +458,4 @@ border-radius: 4px; display: inline-block; } -} +} \ No newline at end of file diff --git a/assets/scss/partials/widgets.scss b/assets/scss/partials/widgets.scss index 42cfcc2..d7165e1 100644 --- a/assets/scss/partials/widgets.scss +++ b/assets/scss/partials/widgets.scss @@ -33,6 +33,15 @@ } } } + .tagCloud-count { + color: var(--body-text-color); + } +} + +.article-category { + display: flex; + flex-wrap: wrap; + gap: 10px; } /* Archives widget */ diff --git a/assets/ts/main.ts b/assets/ts/main.ts index f3160ae..775642b 100644 --- a/assets/ts/main.ts +++ b/assets/ts/main.ts @@ -47,10 +47,12 @@ let Stack = { const colors = await getColor(key, hash, imageURL); - articleDetails.style.background = ` - linear-gradient(0deg, - rgba(${colors.DarkMuted.rgb[0]}, ${colors.DarkMuted.rgb[1]}, ${colors.DarkMuted.rgb[2]}, 0.5) 0%, - rgba(${colors.Vibrant.rgb[0]}, ${colors.Vibrant.rgb[1]}, ${colors.Vibrant.rgb[2]}, 0.75) 100%)`; + /** + * articleDetails.style.background = ` + * linear-gradient(0deg, + * rgba(${colors.DarkMuted.rgb[0]}, ${colors.DarkMuted.rgb[1]}, ${colors.DarkMuted.rgb[2]}, 0.5) 0%, + * rgba(${colors.Vibrant.rgb[0]}, ${colors.Vibrant.rgb[1]}, ${colors.Vibrant.rgb[2]}, 0.75) 100%)`; + */ }) }) }); diff --git a/data/external.yaml b/data/external.yaml index 4fc0bca..a0892f7 100644 --- a/data/external.yaml +++ b/data/external.yaml @@ -1,44 +1,44 @@ Vibrant: - - src: https://cdn.jsdelivr.net/npm/node-vibrant@3.1.6/dist/vibrant.min.js + - src: https://blog.sakurasen.cn/src/vibrant.min.js integrity: sha256-awcR2jno4kI5X0zL8ex0vi2z+KMkF24hUW8WePSA9HM= type: script PhotoSwipe: - - src: https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.js + - src: https://blog.sakurasen.cn/src/photoswipe.min.js integrity: sha256-ePwmChbbvXbsO02lbM3HoHbSHTHFAeChekF1xKJdleo= type: script defer: true - - src: https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe-ui-default.min.js + - src: https://blog.sakurasen.cn/src/photoswipe-ui-default.min.js integrity: sha256-UKkzOn/w1mBxRmLLGrSeyB4e1xbrp4xylgAWb3M42pU= type: script defer: true - - src: https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/default-skin/default-skin.min.css + - src: https://blog.sakurasen.cn/src/default-skin.min.css type: style - - src: https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.css + - src: https://blog.sakurasen.cn/src/photoswipe.min.css type: style KaTeX: - - src: https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.css + - src: https://blog.sakurasen.cn/src/katex.min.css integrity: sha384-n8MVd4RsNIU0tAv4ct0nTaAbDJwPJzDEaqSD1odI+WdtXRGWt2kTvGFasHpSy3SV type: style - - src: https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.js + - src: https://blog.sakurasen.cn/src/katex.min.js integrity: sha384-XjKyOOlGwcjNTAIQHIpgOno0Hl1YQqzUOEleOLALmuqehneUG+vnGctmUb0ZY0l8 type: script defer: true - - src: https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/contrib/auto-render.min.js + - src: https://blog.sakurasen.cn/src/auto-render.min.js integrity: sha384-+VBxd3r6XgURycqtZ117nYw44OOcIax56Z4dCRWbxyPt0Koah1uHoK0o4+/RRE05 type: script defer: true Cactus: - - src: https://latest.cactus.chat/cactus.js + - src: https://blog.sakurasen.cn/src/cactus.js integrity: type: script - - src: https://latest.cactus.chat/style.css + - src: https://blog.sakurasen.cn/src/style.css integrity: type: style diff --git a/i18n/en.yaml b/i18n/en.yaml index fb07328..ff179fd 100644 --- a/i18n/en.yaml +++ b/i18n/en.yaml @@ -32,6 +32,10 @@ article: readingTime: one: "{{ .Count }} minute read" other: "{{ .Count }} minute read" + wordCount: + other: "{{.Count}} words" + totalword: + other: "{{ .PostCount }} Posts and {{ .TotalWords }} Words" notFound: title: @@ -71,3 +75,9 @@ footer: designedBy: other: Theme {{ .Theme }} designed by {{ .DesignedBy }} + copy: + other: Copyright + donate: + other: Donate + feedback: + other: Feedback diff --git a/i18n/zh-cn.yaml b/i18n/zh-cn.yaml index da39c8f..bf1ad80 100644 --- a/i18n/zh-cn.yaml +++ b/i18n/zh-cn.yaml @@ -26,6 +26,10 @@ article: readingTime: other: "阅读时长: {{ .Count }} 分钟" + wordCount: + other: "{{.Count}} 字" + totalword: + other: "发表了 {{ .PostCount }} 篇文章 · 总计 {{ .TotalWords }} 字" notFound: title: @@ -65,3 +69,10 @@ footer: designedBy: other: 主题 {{ .Theme }} 由 {{ .DesignedBy }} 设计 + copy: + other: 版权说明 + donate: + other: 支持我 + feedback: + other: 反馈 + diff --git a/layouts/_default/_markup/render-link.html b/layouts/_default/_markup/render-link.html index 843854d..f4f87fd 100644 --- a/layouts/_default/_markup/render-link.html +++ b/layouts/_default/_markup/render-link.html @@ -1,3 +1,10 @@ -{{ .Text | safeHTML }} \ No newline at end of file +{{ .Text | safeHTML }} +{{ if strings.HasPrefix .Destination "http" }} + + + + +{{ end }} \ No newline at end of file diff --git a/layouts/_default/archives.html b/layouts/_default/archives.html index 5d5243c..26e2ea7 100644 --- a/layouts/_default/archives.html +++ b/layouts/_default/archives.html @@ -14,7 +14,25 @@ {{ end }} - + {{- $taxonomy := $.Site.GetPage "taxonomyTerm" "tags" -}} + {{- $terms := $taxonomy.Pages -}} + {{ if $terms }} +
+

{{ $taxonomy.Title }}

+ +
+ {{ if ne (len $.Site.Taxonomies.tags) 0 }} + {{ range $name, $taxonomy := $.Site.Taxonomies.tags }} + {{ $tagCount := len $taxonomy.Pages }} + + {{ $name }}{{ $tagCount }} + + {{ end }} + {{ end }} +
+
+ {{ end }} + {{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }} {{ $notHidden := where .Site.RegularPages "Params.hidden" "!=" true }} {{ $filtered := ($pages | intersect $notHidden) }} diff --git a/layouts/partials/article-list/compact.html b/layouts/partials/article-list/compact.html index 376512a..bfb5c5e 100644 --- a/layouts/partials/article-list/compact.html +++ b/layouts/partials/article-list/compact.html @@ -4,11 +4,17 @@

{{- .Title -}}

+ {{ with .Params.description }} +

+ {{ . }} +

+ {{ end }}
+ {{- $image := partialCached "helper/image" (dict "Context" . "Type" "articleList") .RelPermalink "articleList" -}} diff --git a/layouts/partials/article/components/details.html b/layouts/partials/article/components/details.html index 7c27302..b062102 100644 --- a/layouts/partials/article/components/details.html +++ b/layouts/partials/article/components/details.html @@ -2,9 +2,9 @@ {{ if .Params.categories }} {{ end }} @@ -15,7 +15,7 @@ {{- .Title -}} - + {{ with .Params.description }}

{{ . }} @@ -29,33 +29,43 @@ {{ if $showFooter }}
{{ if $showDate }} -
- {{ partial "helper/icon" "date" }} - -
+
+ {{ partial "helper/icon" "date" }} + +
{{ end }} {{ if $showReadingTime }} -
- {{ partial "helper/icon" "clock" }} - -
+
+ {{ partial "helper/icon" "clock" }} + +
{{ end }} + {{ if .Site.Params.article.readingTime }} +
+ {{ partial "helper/icon" "file-description" }} + +
+ {{ end }} +
{{ end }} {{ if .IsTranslated }} - + {{ end }} - + + \ No newline at end of file diff --git a/layouts/partials/footer/components/custom-font.html b/layouts/partials/footer/components/custom-font.html index 8e2ff37..e69de29 100644 --- a/layouts/partials/footer/components/custom-font.html +++ b/layouts/partials/footer/components/custom-font.html @@ -1,11 +0,0 @@ - \ No newline at end of file diff --git a/layouts/partials/footer/custom.html b/layouts/partials/footer/custom.html index e69de29..751fa08 100644 --- a/layouts/partials/footer/custom.html +++ b/layouts/partials/footer/custom.html @@ -0,0 +1,19 @@ + + + + \ No newline at end of file diff --git a/layouts/partials/footer/footer.html b/layouts/partials/footer/footer.html index 179357b..8c12a75 100644 --- a/layouts/partials/footer/footer.html +++ b/layouts/partials/footer/footer.html @@ -1,23 +1,59 @@ {{- $ThemeVersion := "3.30.0" -}} \ No newline at end of file diff --git a/layouts/partials/head/custom.html b/layouts/partials/head/custom.html index e69de29..533faaa 100644 --- a/layouts/partials/head/custom.html +++ b/layouts/partials/head/custom.html @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/layouts/partials/sidebar/left.html b/layouts/partials/sidebar/left.html index 21e7d3e..a6315d0 100644 --- a/layouts/partials/sidebar/left.html +++ b/layouts/partials/sidebar/left.html @@ -100,4 +100,4 @@ - + \ No newline at end of file diff --git a/layouts/partials/widget/categories.html b/layouts/partials/widget/categories.html index 10c8a35..a2af46a 100644 --- a/layouts/partials/widget/categories.html +++ b/layouts/partials/widget/categories.html @@ -1,15 +1,15 @@ {{- $context := .Context -}} {{- $limit := default 10 .Params.limit -}} -
+
{{ partial "helper/icon" "categories" }}

{{ T "widget.categoriesCloud.title" }}

-
+
{{ range first $limit $context.Site.Taxonomies.categories.ByCount }} - {{ .Page.Title }} + {{ .Page.Title }}{{ .Count }} {{ end }}
diff --git a/layouts/partials/widget/tag-cloud.html b/layouts/partials/widget/tag-cloud.html index e64e5e2..dd2aebb 100644 --- a/layouts/partials/widget/tag-cloud.html +++ b/layouts/partials/widget/tag-cloud.html @@ -10,6 +10,8 @@ {{ range first $limit $context.Site.Taxonomies.tags.ByCount }} {{ .Page.Title }} + {{/* 添加计数显示 */}} + {{ .Count }} {{ end }}