Skip to content

Commit 22365a3

Browse files
update test
1 parent 0ada9c1 commit 22365a3

File tree

2 files changed

+96
-0
lines changed

2 files changed

+96
-0
lines changed

_data/friends.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
- name: CS Academy Graph Editor
2+
url: https://csacademy.com/app/graph_editor/
3+
avatar: https://www.google.com/s2/favicons?domain=csacademy.com # 可以用这个API自动获取网站图标,也可以是自己指定的图片链接
4+
desc: 在线图论作图工具 源码来自...
5+
6+
- name: 开发搜
7+
url: https://www.devso.fun/
8+
avatar: /assets/images/friends/devso.png # 也可以是存放在你自己项目的图片路径
9+
desc: DevSo.Fun - 一款为开发者而生的...
10+
11+
- name: zzh's homepage
12+
url: https://zzh.im/
13+
avatar: https://zzh.im/favicon.png
14+
desc: zzh's homepage
15+
16+
- name: Lotuses's Blog
17+
url: https://lotuses.github.io/
18+
avatar: https://lotuses.github.io/images/avatar.png
19+
desc: Deserted World

_tabs/friends.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,80 @@
33
icon: fas fa-link
44
order: 4
55
---
6+
7+
<div class="friend-links-container">
8+
{% for friend in site.data.friends %}
9+
<a href="{{ friend.url }}" target="_blank" class="friend-card" title="{{ friend.name }}">
10+
<div class="friend-card-avatar">
11+
<img src="{{ friend.avatar }}" alt="{{ friend.name }}'s avatar" onerror="this.src='https://www.google.com/s2/favicons?domain={{ friend.url | split: '//' | last | split: '/' | first }}'; this.onerror=null;" />
12+
</div>
13+
<div class="friend-card-info">
14+
<div class="friend-card-name">{{ friend.name }}</div>
15+
<div class="friend-card-desc">{{ friend.desc }}</div>
16+
</div>
17+
</a>
18+
{% endfor %}
19+
</div>
20+
21+
<style>
22+
.friend-links-container {
23+
display: grid;
24+
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
25+
gap: 20px; /* 卡片之间的间距 */
26+
}
27+
28+
.friend-card {
29+
display: flex;
30+
align-items: center;
31+
padding: 15px;
32+
border-radius: 8px;
33+
background-color: #f8f9fa; /* 卡片背景色,你可以根据你的主题调整 */
34+
box-shadow: 0 2px 4px rgba(0,0,0,0.05);
35+
transition: all 0.3s ease;
36+
color: inherit; /* 继承父元素的文字颜色 */
37+
text-decoration: none; /* 去掉下划线 */
38+
}
39+
40+
.friend-card:hover {
41+
transform: translateY(-5px);
42+
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
43+
background-color: #ffffff; /* 鼠标悬浮时的背景色 */
44+
}
45+
46+
.friend-card-avatar {
47+
flex-shrink: 0;
48+
width: 50px;
49+
height: 50px;
50+
margin-right: 15px;
51+
}
52+
53+
.friend-card-avatar img {
54+
width: 100%;
55+
height: 100%;
56+
border-radius: 50%; /* 圆形头像 */
57+
object-fit: cover;
58+
background-color: #fff; /* 防止透明背景的png图片看起来奇怪 */
59+
}
60+
61+
.friend-card-info {
62+
overflow: hidden; /* 防止文字过长溢出 */
63+
}
64+
65+
.friend-card-name {
66+
font-size: 1.1em;
67+
font-weight: bold;
68+
color: #333;
69+
white-space: nowrap;
70+
overflow: hidden;
71+
text-overflow: ellipsis; /* 名字太长时显示省略号 */
72+
}
73+
74+
.friend-card-desc {
75+
font-size: 0.9em;
76+
color: #6c757d;
77+
margin-top: 5px;
78+
white-space: nowrap;
79+
overflow: hidden;
80+
text-overflow: ellipsis; /* 简介太长时显示省略号 */
81+
}
82+
</style>

0 commit comments

Comments
 (0)