update: friends page

This commit is contained in:
2026-06-18 19:52:08 +08:00
parent ca58e5a20e
commit 7948aaeb90
3 changed files with 25 additions and 14 deletions

3
.gitignore vendored
View File

@@ -30,3 +30,6 @@ resources
assets/jsconfig.json assets/jsconfig.json
.DS_Store .DS_Store
# hugo build logs
*.log

View File

@@ -1,5 +1,6 @@
--- ---
title: "友情链接" title: "友情链接"
linksTitle: "朋友们"
slug: "friend" slug: "friend"
layout: links layout: links
menu: menu:
@@ -12,7 +13,7 @@ edit: false
comment: true comment: true
--- ---
### 申请要求 ## 申请要求
感谢添加我为友链,作为互联网的一个独立的小角落,也希望您的网站能够满足以下几点简单的要求 感谢添加我为友链,作为互联网的一个独立的小角落,也希望您的网站能够满足以下几点简单的要求
@@ -25,7 +26,7 @@ comment: true
我将每个季度审查一次所有已添加友链的网站,若发现网站无法访问或不符合上述要求,将移除该友链 我将每个季度审查一次所有已添加友链的网站,若发现网站无法访问或不符合上述要求,将移除该友链
### 友链申请格式 ## 友链申请格式
请按以下格式在评论区留言~ 请按以下格式在评论区留言~
@@ -35,4 +36,4 @@ comment: true
> >
> 网站图像:<https://cdn.taurusxin.com/hugo/avatar.jpg> > 网站图像:<https://cdn.taurusxin.com/hugo/avatar.jpg>
> >
> 网站描述:永远年轻 永远热泪盈眶 > 网站描述:永远年轻 永远热泪盈眶

View File

@@ -1,35 +1,42 @@
{{ define "body-class" }}article-page keep-sidebar{{ end }} {{ define "body-class" }}article-page keep-sidebar links-page{{ end }}
{{ define "main" }} {{ define "main" }}
<div class="article-list--compact links"> {{ $linksTitle := default .Title .Params.linksTitle }}
<section class="links-section" aria-labelledby="links-title">
<header class="links-section__header">
<h1 id="links-title">{{ $linksTitle }}</h1>
</header>
<div class="links-grid">
{{ $siteResources := resources }} {{ $siteResources := resources }}
{{ range $i, $link := hugo.Data.links }} {{ range $link := hugo.Data.links }}
<article> <article class="link-card">
<a href="{{ $link.website }}" target="_blank" rel="noopener"> <a href="{{ $link.website }}" target="_blank" rel="noopener">
<div class="article-details"> <div class="link-card__details">
<h2 class="article-title"> <h2 class="link-card__title">
{{- $link.title -}} {{- $link.title -}}
</h2> </h2>
<footer class="article-time"> <p class="link-card__description">
{{ with $link.description }} {{ with $link.description }}
{{ . }} {{ . }}
{{ else }} {{ else }}
{{ $link.website }} {{ $link.website }}
{{ end }} {{ end }}
</footer> </p>
</div> </div>
{{ if $link.image }} {{ if $link.image }}
{{ $image := $siteResources.Get (delimit (slice "link-img/" $link.image) "") | resources.Fingerprint "md5" }} {{ $image := $siteResources.Get (delimit (slice "link-img/" $link.image) "") | resources.Fingerprint "md5" }}
{{ $imageResized := $image.Resize "120x120" }} {{ $imageResized := $image.Resize "120x120" }}
<div class="article-image"> <div class="link-card__image">
<img src="{{ $imageResized.RelPermalink }}" width="{{ $imageResized.Width }}" height="{{ $imageResized.Height }}" <img src="{{ $imageResized.RelPermalink }}" width="{{ $imageResized.Width }}" height="{{ $imageResized.Height }}"
loading="lazy" data-key="links-{{ $link.website }}" data-hash="{{ $image.Data.Integrity }}"> loading="lazy" alt="{{ $link.title }}" data-key="links-{{ $link.website }}" data-hash="{{ $image.Data.Integrity }}">
</div> </div>
{{ end }} {{ end }}
</a> </a>
</article> </article>
{{ end }} {{ end }}
</div> </div>
</section>
{{ partial "article/article.html" . }} {{ partial "article/article.html" . }}