![Hexo:添加友链鱼塘](https://s3.qjqq.cn/47/66224075412c5.webp!color)
Hexo:添加友链鱼塘
文章摘要
Efu Chat
介绍
友链鱼塘是一种友链展示方式,可以展示友链的最新文章,让你的网站更加活跃。
教程
使用命令创建页面
1
hexo new page moments
将以下内容复制到 source/moments/index.md 中
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27---
title: 友链鱼塘
desc: 最新文章订阅
date: 2024-01-28 21:29:15
type: "banner"
cover: ''
leftend: 使用 友链朋友圈 订阅友链最新文章
---
## 🐟 鱼塘
<div id="hexo-circle-of-friends-root"></div>
<script>
let UserConfig = {
private_api_url: 'http://192.168.31.44:8000/', /* 填写你的api地址 */
page_turning_number: 12, /* 点击加载更多时,一次最多加载几篇文章,默认10 */
error_img: 'https://sdn.geekzu.org/avatar/57d8260dfb55501c37dde588e7c3852c', /* 头像加载失败时,默认头像地址 */
sort_rule: 'created', /* 进入页面时第一次的排序规则 */
};
</script>
<style>
.cf-article-group{
margin: 0 -8px;
}
</style>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/zhheo/JS-Heo@master/mainColor/heoMainColor.css">
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/zhheo/JS-Heo@master/moments5/app.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/zhheo/JS-Heo@master/moments5/bundle.js"></script>修改 private_api_url 为你的api地址
重新生成网站
1
hexo clean && hexo g
添加钓鱼
在 moments/index.md 顶部(front-matter以下)添加以下代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22<div class="title-h2-a">
<div class="title-h2-a-left">
<h2 style="padding-top: 0;margin:0.6rem 0 0.6rem;">🎣 钓鱼</h2>
<a href="javascript:fetchRandomPost();" id="random-post-start" style="transition-duration: 0.3s; transform: rotate(63000deg); opacity: 1;" data-pjax-state="">
<i class="solitude st-restart-line"></i>
</a>
</div>
<div class="title-h2-a-right">
<a href="/links/" data-pjax-state="">全部友链</a>
</div>
</div>
<div id="random-post"></div>
<script>
var fdata = {
apiurl: "http://192.168.31.44:8000/", /* 填写你的api地址 */
defaultFish: 100,
hungryFish: 100,
}
</script>
</script>在 moments/index.md 中的 style 标签里添加以下代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52#random-post {
min-height: 32px;
background: var(--efu-card-bg);
border: var(--style-border-always);
box-shadow: var(--efu-shadow-border);
padding: 20px 30px;
border-radius: 12px;
margin-top: 8px;
}
.random-friends-post {
text-decoration: none;
border-bottom: 2px solid var(--efu-lighttext);
color: var(--efu-fontcolor);
font-weight: 700;
padding: 0 4px;
}
.random-friends-post:hover {
text-decoration: none;
border-bottom: 2px solid var(--efu-none);
color: var(--efu-white);
background: var(--efu-main);
border-radius: 4px;
box-shadow: var(--efu-shadow-main);
}
.random-post-start {
transition-duration: 0.3s;
}
.random-post-start:hover {
color: var(--efu-hovertext);
}
#page .title-h2-a {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 0.5rem;
}
#page .title-h2-a a {
margin-left: 0.5rem;
color: var(--efu-secondtext);
font-weight: 700;
}
#page .title-h2-a a:hover {
color: var(--efu-main);
}
#page .title-h2-a .title-h2-a-left {
display: flex;
align-items: center;
}
#page .title-h2-a .title-h2-a-right {
font-size: 14px;
color: var(--efu-secondtext);
}
完整代码
1 | --- |
效果
- 感谢您的赞赏。
赞赏名单
因为有你们的支持,我才体会到写文章的价值。
本文是原创文章,采用CC BY-NC-SA 4.0协议,完整转载请注明来自Ever Fu
评论 ()