惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
人人都是产品经理
人人都是产品经理
Cisco Talos Blog
Cisco Talos Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
V
V2EX
博客园 - 三生石上(FineUI控件)
Martin Fowler
Martin Fowler
WordPress大学
WordPress大学
D
Docker
S
SegmentFault 最新的问题
博客园 - 聂微东
美团技术团队
Apple Machine Learning Research
Apple Machine Learning Research
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Last Week in AI
Last Week in AI
M
MIT News - Artificial intelligence
F
Fortinet All Blogs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
The GitHub Blog
The GitHub Blog
GbyAI
GbyAI
L
LangChain Blog
Vercel News
Vercel News
博客园 - 叶小钗
MongoDB | Blog
MongoDB | Blog
Stack Overflow Blog
Stack Overflow Blog
H
Help Net Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
The Cloudflare Blog
Engineering at Meta
Engineering at Meta
T
Threat Research - Cisco Blogs
T
Threatpost
Scott Helme
Scott Helme
T
Tailwind CSS Blog
Latest news
Latest news
Stack Overflow Blog
Stack Overflow Blog
Blog — PlanetScale
Blog — PlanetScale
The Register - Security
The Register - Security
罗磊的独立博客
P
Proofpoint News Feed
腾讯CDC
S
Schneier on Security
雷峰网
雷峰网
A
About on SuperTechFans
T
Tenable Blog
F
Full Disclosure
Cyberwarzone
Cyberwarzone
博客园_首页
有赞技术团队
有赞技术团队
K
Kaspersky official blog

文章列表

不改一行插件代码,实现消息优先级与阻断 洛玖定时任务系统 在 butterfly 主题中添加首页点集动画(基于p2line项目) 你好,2026 stm32f4xx-ads1256驱动 stm32f4xx-ad9854并行驱动 主动式网站状态监测实现及其应用 右键菜单加入用Trae打开文件和文件夹 三角洲行动ID映射表 洛玖SDK说明 Hexo-Butterfly主题在主页添加GitHub贡献日历 Proteus中555定时器仿真问题 装饰器 洛玖开发日记 STS3032舵机获取力矩输出 kotlin网页前后端那些事 mspm0g3507-ad9850 奇怪的bug Paddle模型转PaddleLite
为网页文章开头添加原文连接
洛屿 · 2025-03-28 · via

本文介绍如何在博客文章页面添加原文链接,并进行动画效果美化,效果如下:


向插件目录中添加

post-copyright-link.pug文件

这里我使用的是butter_fly主题,post-copyright-link.pug文件放在了butterfly主题下的相关文件夹中:

/butterfly/layout/includes/post/post-copyright-link.pug

1
2
3
4
5
6
7
8
.post-copyright-link
.post-copyright-link-divider
.divider-line-fancy
.post-copyright-link-content
span 原文链接:
a(href=url_for(page.permalink) target="_blank")= page.title + ' | ' + config.title
.post-copyright-link-divider
.divider-line-fancy

向文章页面附加:

如果你使用的是butterfly主题,请修改:/butterfly/layout/includes/post.pug文件

1
2
3
4
5
6
7
8
// ... 现有代码 ...
// 在文章内容前添加原文链接
include includes/post/post-copyright-link.pug

// ↓↓↓↓↓文章内容部分
article#article-container.post-content!=page.content

// ... 现有代码 ...

添加post.styl文件:

如果你使用的是butterfly主题,请添加:/butterfly/source/css/_page/post.styl文件

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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// 原文链接样式
.post-copyright-link
margin: 2rem 0 1rem
padding: 0.5rem 0

.post-copyright-link-divider
text-align: center
margin: 1rem 0

.divider-line-fancy
position: relative
height: 1px
font-size: 0
line-height: 0
margin: 0 auto
width: 90%
background: transparent

&:before
content: ''
position: absolute
top: 50%
left: 0
right: 0
height: 1px
// 分割线渐变色:从透明到浅蓝色(#64b5f6)再到透明,营造出柔和的淡入淡出效果
background-image: linear-gradient(to right, rgba(0,0,0,0), rgba(100,181,246,0.6), rgba(0,0,0,0))
transform: translateY(-50%)

&:after
// ❀、♥、✿、✽
content: '❀'
position: absolute
top: 0
left: 50%
font-size: 16px
// 花朵装饰颜色:浅蓝色(#64b5f6),与分割线颜色呼应
color: #64b5f6
background: var(--card-bg)
padding: 0 15px
transform: translate(-50%, -50%)

.post-copyright-link-content
font-size: 0.9rem
color: var(--font-color)
text-align: center

a
display: inline-block
// 链接文字渐变色:从深蓝色(#1e88e5)到浅蓝色(#64b5f6)再到中蓝色(#42a5f5)
// #1e88e5 - Material Design 蓝色 600
// #64b5f6 - Material Design 蓝色 300
// #42a5f5 - Material Design 蓝色 400
background-image: linear-gradient(to right, #1e88e5, #64b5f6, #42a5f5)
-webkit-background-clip: text
background-clip: text
color: transparent
text-decoration: none
position: relative

&:after
content: ''
position: absolute
left: 0
bottom: -2px
width: 100%
height: 1px
// 悬停时显示的下划线渐变色:与链接文字渐变色相同
background-image: linear-gradient(to right, #1e88e5, #64b5f6, #42a5f5)
transform: scaleX(0)
transition: transform 0.3s ease
transform-origin: right

&:hover
&:after
transform: scaleX(1)
transform-origin: left

完成上述操作,执行hexo三连

1
hexo cl & hexo g & hexo d

文章内容前就会出现原文连接啦,如果你想修改样式,请修改post.styl文件

最后

有什么不懂的,欢迎加群询问哦!

洛の小窝

版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 洛屿的小站

打赏

  • wechat

    wechat

  • alipay

    alipay