diff --git a/assets/_custom.scss b/assets/_custom.scss index 026c08e7..6d44709d 100644 --- a/assets/_custom.scss +++ b/assets/_custom.scss @@ -4366,7 +4366,8 @@ body { .entry-cluster-count, .section-index-count, .section-directory-heading, -.contributors-heading > span { +.contributors-heading > span, +.friends-heading > span { color: var(--goclub-muted-text); font-size: 0.74rem; font-weight: 650; @@ -4425,7 +4426,8 @@ body { .entry-cluster-heading, .section-index-heading, .section-directory-heading, -.contributors-heading { +.contributors-heading, +.friends-heading { display: flex; align-items: flex-end; justify-content: space-between; @@ -4577,7 +4579,8 @@ body { .entry-cluster-heading, .section-index-heading, -.contributors-heading { +.contributors-heading, +.friends-heading { position: relative; padding-bottom: 1.05rem; border-bottom: 0; @@ -4585,7 +4588,8 @@ body { .entry-cluster-heading::after, .section-index-heading::after, -.contributors-heading::after { +.contributors-heading::after, +.friends-heading::after { position: absolute; inset-inline-start: 0; bottom: 0.15rem; @@ -4602,7 +4606,8 @@ body { .book-article .entry-cluster-heading h2, .book-article .section-index-heading h2, -.book-article .contributors-heading h2 { +.book-article .contributors-heading h2, +.book-article .friends-heading h2 { margin: 0.22rem 0 0; padding: 0; border: 0; @@ -5160,6 +5165,134 @@ body { background: transparent; } +.friends-section { + margin-top: clamp(2.5rem, 5vw, 4rem); +} + +.markdown .friends-list { + display: grid; + grid-template-columns: minmax(0, 1fr); + gap: 0; + margin: 0; + padding: 0; + list-style: none; +} + +.markdown .friends-list .friend-row { + min-width: 0; + margin: 0; + padding: 0; + border-bottom: 1px solid var(--goclub-editorial-rule); +} + +.markdown .friend-row-link[href], +.markdown .friend-row-link[href]:visited { + display: flex; + min-width: 0; + align-items: flex-start; + gap: 1rem; + padding: 1.05rem 0.65rem; + border-radius: 0.7rem; + color: var(--body-font-color); + text-decoration: none; + transition: background-color 0.18s ease, color 0.18s ease; +} + +.markdown .friend-row-link[href]:hover, +.markdown .friend-row-link[href]:focus-visible { + background: linear-gradient( + 100deg, + var(--goclub-editorial-hover), + var(--goclub-editorial-warm) 70%, + transparent + ); + color: var(--goclub-primary); + text-decoration: none; +} + +.markdown .friend-row-link[href]:focus-visible { + outline: 2px solid rgba(var(--goclub-primary-rgb), 0.42); + outline-offset: 2px; +} + +.friend-avatar { + display: grid; + width: 3.25rem; + height: 3.25rem; + flex: 0 0 3.25rem; + place-items: center; + overflow: hidden; + border: 1px solid rgba(var(--goclub-primary-rgb), 0.14); + border-radius: 50%; + background: rgba(var(--goclub-primary-rgb), 0.1); + color: var(--goclub-primary); +} + +.friend-avatar-fallback, +.friend-avatar-image { + grid-area: 1 / 1; +} + +.friend-avatar-fallback { + color: var(--goclub-primary); + font-size: 1rem; + font-weight: 760; + opacity: 1; +} + +:root body[class*="book-kind-"] .markdown img.friend-avatar-image { + width: 3.25rem; + height: 3.25rem; + max-width: none; + border: 0; + border-radius: 50%; + background: var(--goclub-surface-muted); + box-shadow: none; + object-fit: cover; + z-index: 1; +} + +.friend-body { + display: grid; + min-width: 0; + flex: 1 1 0; + gap: 0.28rem; +} + +.friend-name { + color: inherit; + font-size: 1.2rem; + font-weight: 800; + line-height: 1.25; + overflow-wrap: anywhere; +} + +.friend-description { + display: -webkit-box; + overflow: hidden; + color: var(--goclub-muted-text); + font-size: 0.93rem; + line-height: 1.55; + overflow-wrap: anywhere; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; +} + +.friend-arrow { + align-self: center; + color: var(--goclub-primary); + font-size: 0.92rem; + opacity: 0.42; + transform: translateX(-0.15rem); + transition: opacity 0.18s ease, transform 0.18s ease; +} + +.markdown .friend-row-link[href]:hover .friend-arrow, +.markdown .friend-row-link[href]:focus-visible .friend-arrow { + opacity: 1; + transform: translateX(0); +} + :root body[class*="book-kind-"] .book-page > .book-footer { margin-top: clamp(3rem, 6vw, 5rem); padding-top: 1.25rem; @@ -5667,6 +5800,7 @@ body { .section-index-heading, .section-directory-heading, .contributors-heading, + .friends-heading, .goclub-footer-meta { align-items: flex-start; flex-wrap: wrap; diff --git a/content/docs/blog/friends.md b/content/docs/blog/friends.md new file mode 100644 index 00000000..928d0df4 --- /dev/null +++ b/content/docs/blog/friends.md @@ -0,0 +1,13 @@ +--- +title: "博客友链" +weight: 8 +type: docs +description: "收录与 GoClub 相互链接、长期关注的博客与站点。" +aliases: + - "/s/4ym9/" +shortlink: "4ym9" +--- + +# 博客友链 + +以下是与 GoClub 相互链接、长期关注的博客与站点。如果你想交换友链,欢迎到 GitHub 仓库提交 Issue。 diff --git a/content/docs/blog/onenotes.md b/content/docs/blog/onenotes.md deleted file mode 100644 index 43dcd80c..00000000 --- a/content/docs/blog/onenotes.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -title: "Go语言相关笔记" -weight: 3 -type: docs -aliases: - - "/s/zkab/" -shortlink: "zkab" ---- - -# Go语言相关笔记 - -这里整理了 Go 语言相关语法知识,除了基础内容,也包含一些常见框架与工程实践主题,例如 `os`、`err`、`fmt`、`bufio`、`time`、并发、多文件操作,以及 `gin`、`zap`、`go-zero`、`mysql`、`gorm`、`redis`、`docker`、`rabbitmq` 等。 - -这份笔记会随着学习过程持续更新。如果你发现错误,欢迎指出或参与补充。 - -## 使用方法 - -由于原始笔记长期在深色模式下维护,直接通过网页查看时体验可能一般。建议点击对应链接后下载并在本地使用 OneNote 查看。 - -## OneNote 笔记 - -- [查看链接](https://github.com/LeoninCS/GoClub/tree/main/documents/onenote) diff --git a/data/friends.json b/data/friends.json new file mode 100644 index 00000000..43d3b9c2 --- /dev/null +++ b/data/friends.json @@ -0,0 +1,8 @@ +[ + { + "name": "博客名称", + "url": "https://example.com/", + "description": "一句话简介,超过两行会自动截断", + "avatar": "https://example.com/avatar.png" + } +] diff --git a/documents/onenote/Docker.onepkg b/documents/onenote/Docker.onepkg deleted file mode 100644 index 3189da5c..00000000 Binary files a/documents/onenote/Docker.onepkg and /dev/null differ diff --git a/documents/onenote/MySQL.onepkg b/documents/onenote/MySQL.onepkg deleted file mode 100644 index b557dcc3..00000000 Binary files a/documents/onenote/MySQL.onepkg and /dev/null differ diff --git a/documents/onenote/Redis.onepkg b/documents/onenote/Redis.onepkg deleted file mode 100644 index 1a76dc54..00000000 Binary files a/documents/onenote/Redis.onepkg and /dev/null differ diff --git a/documents/onenote/go.onepkg b/documents/onenote/go.onepkg deleted file mode 100644 index 5cf5f1a7..00000000 Binary files a/documents/onenote/go.onepkg and /dev/null differ diff --git a/documents/onenote/rabbitmq.onepkg b/documents/onenote/rabbitmq.onepkg deleted file mode 100644 index f1da7169..00000000 Binary files a/documents/onenote/rabbitmq.onepkg and /dev/null differ diff --git a/layouts/single.html b/layouts/single.html index 3d78b41e..6ccc54b6 100644 --- a/layouts/single.html +++ b/layouts/single.html @@ -2,11 +2,19 @@ {{ $summary := partial "goclub/lead-summary.html" . }} {{ $hasToc := partial "docs/toc-show" . }} {{ $content := partial "goclub/stripped-content.html" . }} + {{ $filePath := replace .File.Path "\\" "/" }} + {{ $isFriends := eq $filePath "docs/blog/friends.md" }} + {{ $friends := slice }} + {{ range hugo.Data.friends }} + {{ if and .name .url }} + {{ $friends = $friends | append . }} + {{ end }} + {{ end }}
- 文章 + {{ if $isFriends }}友链{{ else }}文章{{ end }} {{ with .CurrentSection }} {{ if ne .RelPermalink $.RelPermalink }} {{ partial "docs/title" . }} @@ -21,6 +29,9 @@

{{ partial "docs/title" . }}

{{ if .Params.shortlink }} {{ partial "goclub/share-shortlink-button.html" . }} {{ end }} + {{ if and $isFriends $friends }} + {{ len $friends }} 个友链 + {{ end }} {{ if .GitInfo }} 最近更新:{{ partial "docs/date" (dict "Date" .Lastmod "Format" "2006-01-02") }} {{ end }} @@ -30,5 +41,46 @@

{{ partial "docs/title" . }}

{{- $content | safeHTML -}}
+ + {{ if and $isFriends $friends }} + {{/* 友链数据:data/friends.json → [{ "name", "url", "description", "avatar" }] */}} +
+
+
+ 友情链接 +

博客与站点

+
+ {{ len $friends }} 个友链 +
+ +
+ {{ end }}
{{ end }}