Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
144 changes: 139 additions & 5 deletions assets/_custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -4577,15 +4579,17 @@ body {

.entry-cluster-heading,
.section-index-heading,
.contributors-heading {
.contributors-heading,
.friends-heading {
position: relative;
padding-bottom: 1.05rem;
border-bottom: 0;
}

.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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
13 changes: 13 additions & 0 deletions content/docs/blog/friends.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: "博客友链"
weight: 8
type: docs
description: "收录与 GoClub 相互链接、长期关注的博客与站点。"
aliases:
- "/s/4ym9/"
shortlink: "4ym9"
---

# 博客友链

以下是与 GoClub 相互链接、长期关注的博客与站点。如果你想交换友链,欢迎到 GitHub 仓库提交 Issue。
22 changes: 0 additions & 22 deletions content/docs/blog/onenotes.md

This file was deleted.

8 changes: 8 additions & 0 deletions data/friends.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"name": "博客名称",
"url": "https://example.com/",
"description": "一句话简介,超过两行会自动截断",
"avatar": "https://example.com/avatar.png"
}
]
Binary file removed documents/onenote/Docker.onepkg
Binary file not shown.
Binary file removed documents/onenote/MySQL.onepkg
Binary file not shown.
Binary file removed documents/onenote/Redis.onepkg
Binary file not shown.
Binary file removed documents/onenote/go.onepkg
Binary file not shown.
Binary file removed documents/onenote/rabbitmq.onepkg
Binary file not shown.
54 changes: 53 additions & 1 deletion layouts/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

<article class="markdown book-article book-article--single{{ if $hasToc }} has-page-toc{{ end }}{{ if .Params.preserveWhitespace }} preserve-whitespace{{ end }}">
<header class="page-lead page-lead--article">
<div class="page-lead-overline">
<span>文章</span>
<span>{{ if $isFriends }}友链{{ else }}文章{{ end }}</span>
{{ with .CurrentSection }}
{{ if ne .RelPermalink $.RelPermalink }}
<a href="{{ .RelPermalink }}">{{ partial "docs/title" . }}</a>
Expand All @@ -21,6 +29,9 @@ <h1 class="page-lead-title">{{ partial "docs/title" . }}</h1>
{{ if .Params.shortlink }}
<span class="page-lead-meta-item" role="listitem">{{ partial "goclub/share-shortlink-button.html" . }}</span>
{{ end }}
{{ if and $isFriends $friends }}
<span class="page-lead-meta-item" role="listitem">{{ len $friends }} 个友链</span>
{{ end }}
{{ if .GitInfo }}
<span class="page-lead-meta-item" role="listitem">最近更新:{{ partial "docs/date" (dict "Date" .Lastmod "Format" "2006-01-02") }}</span>
{{ end }}
Expand All @@ -30,5 +41,46 @@ <h1 class="page-lead-title">{{ partial "docs/title" . }}</h1>
<div class="article-prose">
{{- $content | safeHTML -}}
</div>

{{ if and $isFriends $friends }}
{{/* 友链数据:data/friends.json → [{ "name", "url", "description", "avatar" }] */}}
<section class="friends-section" aria-labelledby="friends-list-title">
<header class="friends-heading">
<div>
<span class="editorial-kicker">友情链接</span>
<h2 id="friends-list-title">博客与站点</h2>
</div>
<span>{{ len $friends }} 个友链</span>
</header>
<ul class="friends-list" role="list">
{{ range $friends }}
<li class="friend-row">
<a class="friend-row-link" href="{{ .url }}" target="_blank" rel="noopener noreferrer">
<span class="friend-avatar" aria-hidden="true">
<span class="friend-avatar-fallback">{{ substr .name 0 1 | upper }}</span>
{{ with .avatar }}
<img
class="friend-avatar-image"
src="{{ . }}"
alt=""
loading="lazy"
decoding="async"
onerror="this.hidden=true"
/>
{{ end }}
</span>
<span class="friend-body">
<span class="friend-name">{{ .name }}</span>
{{ with .description }}
<span class="friend-description">{{ . }}</span>
{{ end }}
</span>
<span class="friend-arrow" aria-hidden="true">→</span>
</a>
</li>
{{ end }}
</ul>
</section>
{{ end }}
</article>
{{ end }}
Loading