feat: friend page

This commit is contained in:
TaurusXin 2021-12-16 00:07:58 +00:00
parent 48212b7ee8
commit 7304f01183
11 changed files with 127 additions and 0 deletions

4
assets/icons/heart.svg Normal file
View File

@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-heart" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
<path d="M19.5 13.572l-7.5 7.428l-7.5 -7.428m0 0a5 5 0 1 1 7.5 -6.566a5 5 0 1 1 7.5 6.572" />
</svg>

After

Width:  |  Height:  |  Size: 381 B

BIN
assets/link-img/default.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

BIN
assets/link-img/fan.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

BIN
assets/link-img/rhyland.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

23
content/page/friend.md Normal file
View File

@ -0,0 +1,23 @@
---
title: "友情链接"
slug: "friend"
layout: links
menu:
main:
name: 友链
params:
icon: heart
weight: -80
edit: false
comment: true
---
### 欢迎交换友情链接
> 网站名称TaurusXin 的独立博客
>
> 网站链接:<https://xingez.me>
>
> 网站图像:<https://secure.gravatar.com/avatar/6d119b79c135fe14da072e57431a17e9>
>
> 网站描述:永远年轻 永远热泪盈眶

38
data/links.json Normal file
View File

@ -0,0 +1,38 @@
[
{
"title": "锐岚科技",
"website": "https://blog.rhyland.cn",
"image": "rhyland.png",
"description": "锐岚科技核心博客"
},
{
"title": "木头の小屋",
"website": "https://www.wjlshare.xyz",
"image": "wjlshare.jpg",
"description": "网络安全工程师"
},
{
"title": "帆's life",
"website": "https://huxiaofan.com",
"image": "fan.jpg",
"description": "魔法师预备役"
},
{
"title": "Rogister的博客园",
"website": "http://blog.rogister.top",
"image": "default.png",
"description": "死宅真可怕"
},
{
"title": "PeterQiu 的博客",
"website": "https://peterqiu871217776.wordpress.com",
"image": "peterqiu.jpg",
"description": "守护全世界最好的 Peter"
},
{
"title": "章森森的博客",
"website": "https://blog.thangssen.site",
"image": "thangssen.jpg",
"description": "魔法师预备役"
}
]

43
layouts/page/links.html Normal file
View File

@ -0,0 +1,43 @@
{{ define "body-class" }}article-page keep-sidebar{{ end }}
{{ define "main" }}
{{ partial "article/article.html" . }}
<div class="article-list--compact links">
{{ $siteResources := resources }}
{{ range $i, $link := $.Site.Data.links }}
<article>
<a href="{{ $link.website }}" target="_blank" rel="noopener">
<div class="article-details">
<h2 class="article-title">
{{- $link.title -}}
</h2>
<footer class="article-time">
{{ with $link.description }}
{{ . }}
{{ else }}
{{ $link.website }}
{{ end }}
</footer>
</div>
{{ if $link.image }}
{{ $image := $siteResources.Get (delimit (slice "link-img/" $link.image) "") | resources.Fingerprint "md5" }}
{{ $imageResized := $image.Resize "120x120" }}
<div class="article-image">
<img src="{{ $imageResized.RelPermalink }}" width="{{ $imageResized.Width }}" height="{{ $imageResized.Height }}"
loading="lazy" data-key="links-{{ $link.website }}" data-hash="{{ $image.Data.Integrity }}">
</div>
{{ end }}
</a>
</article>
{{ end }}
</div>
{{ if or (not (isset .Params "comments")) (eq .Params.comments "true")}}
{{ partial "comments/include" . }}
{{ end }}
{{ partialCached "footer/footer" . }}
{{ partialCached "article/components/photoswipe" . }}
{{ end }}

View File

@ -0,0 +1,19 @@
{{$URL := .Get 0}}
{{ with .Site.GetPage $URL }}
<div class="post-preview">
<div class="post-preview--meta" style="width:100%;">
<div class="post-preview--middle">
<h4 class="post-preview--title">
<a target="_blank" href="{{ .Permalink }}">{{ .Title }}</a>
</h4>
<time class="post-preview--date">{{ .Date.Format ( default "2006-01-02") }}</time>
{{ if .Params.tags }}
<small>{{ range .Params.tags }}#{{ . }}&nbsp;{{ end }}</small>
{{ end }}
<section style="max-height:105px;overflow:hidden;" class="post-preview--excerpt">
{{ .Summary | plainify}}
</section>
</div>
</div>
</div>
{{ end }}