📚 更多文档目录

🚀 搭建教程 | 1 - 📑 前置教程 | 2 - 🎈 主题调整 | 3 - ✨ 魔改教程 | 4 - 🐈 重构自用数据记录


本篇教程基于 Hexo 6.3.0 & Butterfly 4.8.5 为博主的魔改教程记录,以防自己日后因魔改迷失所记录 📝

样式参考@张洪Heo,邮件订阅功能实现:follow

效果预览

创建数据

  • 创建并修改 [blogRoot]/source/subscribe/index.md 页面
1
2
3
4
5
6
7
8
9
10
---
title: 订阅本站
date: 2023-07-28 13:01:46
type: subscribe
top_img: false
aside: false
comments: false
---

<!-- 页面内容 -->
  • 创建 [blogRoot]/themes/butterfly/layout/includes/page/subscribe.pug 页面文件,并新增以下内容
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
.rss-plan-list
a.rss-plan-item.rss-plan-wechat(href="/wechatOA/" title="公众号" target="_blank")
.rss-plan-description 推送精选文章<br>推送全文
.rss-plan-info-group
.rss-plan-title 公众号订阅
.rss-plan-info 推荐的订阅方式
img.rss-plan-icon.no-lightbox(src="https://yife68.gitee.io/icat-pic/blog/11.webp")
a.rss-plan-item.rss-plan-mail(onclick="icat.submitInfo()" title="follow")
.rss-plan-description 推送全部文章<br>更新推送简介
.rss-plan-info-group
.rss-plan-title 邮件订阅
.rss-plan-info 推荐的订阅方式
img.rss-plan-icon.no-lightbox(src="https://yife68.gitee.io/icat-pic/blog/12.webp")
a.rss-plan-item.rss-plan-rss(href="/rss2.xml" title="rss" target="_blank")
.rss-plan-description 推送全部文章<br>推送简介
.rss-plan-info-group
.rss-plan-title RSS
.rss-plan-info 备用订阅方式
img.rss-plan-icon.no-lightbox(src="https://yife68.gitee.io/icat-pic/blog/13.webp")

hr

.submit-box
include follow.pug

!= page.content

script
var icat = {
submitInfo: function() {
var submitBox = document.querySelector('.submit-box')

if (submitBox.classList.contains('display')) {
submitBox.classList.remove('display')
} else {
submitBox.classList.add('display')
} // 订阅页点击
}
  • 新增 [blogRoot]/themes/butterfly/layout/page.pug 页面内容项使其匹配
    + 号直接删除 即是正常缩进)
1
2
3
4
5
6
7
8
9
    ···
case page.type
+ when 'subscribe'
+ include includes/page/subscribe.pug
when 'photo'
include includes/page/photo.pug
when 'tags'
include includes/page/tags.pug
···
  • 新建 [blogRoot]/source/css/subscribe.css 样式文件,并新增以下内容
    (也可以在自建的css文件里新增内容)
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
#post .tag_share + #follow {
margin-top: 40px;
}
.rss-plan-list {
display: flex;
width: 100%;
flex-direction: row;
flex-wrap: wrap;
margin: 0 -4px;
position: relative;
justify-content: space-between;
}
.rss-plan-item:visited {
color: var(--icat-white);
}
.rss-plan-item.rss-plan-wechat {
background: #27c125;
}
.rss-plan-item.rss-plan-mail {
background: var(--icat-blue);
}
.rss-plan-item.rss-plan-rss {
background: var(--icat-orange);
}
.rss-plan-item {
border-radius: 12px;
display: flex;
flex-direction: column;
justify-content: space-between;
min-width: 240px;
height: 240px;
margin: 6px 0;
overflow: hidden;
text-decoration: none;
width: calc(100% / 3 - 8px);
filter: brightness(1);
transition: .3s;
border: var(--style-border);
box-shadow: var(--icat-shadow-border);
}
.rss-plan-item:hover {
filter: brightness(1.1)
}
@media screen and (max-width: 1024px) {
.rss-plan-item {
width:calc(100% / 2 - 4px)
}
.rss-plan-item:first-child {
width: 100%
}
}
@media screen and (max-width: 768px) {
.rss-plan-item {
width:100%
}
}
/* 卡片大小 */

.rss-plan-description {
font-size: 16px;
color: var(--icat-white);
margin: 26px 0 0 30px;
line-height: 20px;
}
.rss-plan-info-group {
position: relative;
margin: 0 0 26px 30px;
color: var(--icat-white);
}
.rss-plan-title {
font-size: 36px;
font-weight: 700;
width: fit-content;
line-height: 1;
}
.rss-plan-info {
width: fit-content;
opacity: .6;
}
img.rss-plan-icon {
position: absolute;
bottom: -50px;
right: -20px;
height: 140px;
-webkit-user-drag: none;
user-select: none;
-webkit-transition: all 1.2s cubic-bezier(.39,.575,.565,1) !important;
-moz-transition: all 1.2s cubic-bezier(.39,.575,.565,1) !important;
-o-transition: all 1.2s cubic-bezier(.39,.575,.565,1) !important;
-ms-transition: all 1.2s cubic-bezier(.39,.575,.565,1) !important;
transition: all 1.2s cubic-bezier(.39,.575,.565,1) !important;
transform-origin: bottom right;
filter: blur(8px);
opacity: .6;
}
.rss-plan-item:hover img.rss-plan-icon {
bottom: -40px;
right: -10px;
filter: blur(0);
opacity: 1
}
.rss-plan-item:hover {
text-decoration: none !important;
}
/* 卡片订阅样式 */

.follow-it-form-subscribe {
position: relative;
display: block;
padding: 26px;
width: 100%;
height: auto;
border-radius: 12px;
border: var(--style-border);
box-shadow: var(--icat-shadow-border);
background-color: var(--icat-background);
}
@media screen and (min-width: 768px) and (max-width: 1920px) {
.follow-it-form-subscribe::before {
content: '';
background: url(https://yife68.gitee.io/icat-pic/blog/follow.svg);
position: absolute;
top: 30px;
right: 26px;
width: 122px;
height: 25px;
filter: blur(2px);
}
}
.follow-it-form-subscribe .heading {
width: 100%;
margin-bottom: 0.5rem;
}
.follow-it-form-subscribe .heading h5 {
margin: 0 0 0.2rem 0;
color: var(--icat-fontcolor);
font-size: 18px;
}
.follow-it-form-subscribe .input-field {
margin-top: 20px;
width: 100%;
}
.follow-it-form-subscribe .input-field input {
width: 100%;
height: 48px;
border-radius: 6px;
border: 2px solid var(--icat-card-border);
outline: none;
}
.follow-it-form-subscribe .input-field input::placeholder,
.follow-it-form-subscribe .input-field input {
opacity: .6;
background: var(--icat-secondbg);
color: var(--icat-fontcolor);
font-size: 14px;
font-weight: 500;
line-height: 20px;
text-align: center;
}
.follow-it-form-subscribe .submit-button {
margin-top: 16px;
width: 100%;
}
.follow-it-form-subscribe .submit-button button {
width: 100%;
height: 42px;
border: 0;
border-radius: 6px;
line-height: 0;
color: var(--icat-white);
background: var(--icat-black);
box-shadow: var(--icat-shadow-border);
transition: .3s;
}
.follow-it-form-subscribe .submit-button button:hover {
cursor: pointer;
background: var(--icat-blue);
}
.submit-box {
opacity: 0;
height: 0;
transition: all .3s ease 0s;
}
.submit-box.display {
opacity: 1;
height: auto;
}
/* follow样式 */

/* 订阅样式 */
  • _config.butterfly.yml 主题配置文件中 inject 下的 head 引入 subscribe.css 样式
1
2
3
4
5
6
7
8
9
10
  ···

inject:
head:
- <link rel="stylesheet" href="/css/subscribe.css"> # 订阅页样式
- ···
bottom:
- ···

···
  • 新增 [blogRoot]/source/subscribe/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
28
# 订阅本站

首先,对每一位来到这里的iCat喵友们说声 "有幸遇见 很高兴认识你" 👋
创立iCat的初衷也是想着每一个人都可以像猫咪那样过的有仪式感;傲娇性随时放射;有位猫主子宠着
也是想能够有一个让自己积累知识、积累兴趣的地方;是属于自己的温暖小窝;也是偌大的社会里的属于自己的内心避风港
和他人分享,会让这些成为积累和沉淀。如果能够帮助到更多的人,帮助更多人解决问题,那一定是非常棒的事情

与大多数垂直类的技术博客不同,这里的种类会非常的繁杂,有技能的教程干货、有生活上的吐槽和想法;所以一般我研究什么、发现了什么都会分享在这里
这些就是创造 MueiCat 的本意,也是我分享生活的方式。有幸能和你相遇在这里,相信我们能共同留下一段美好记忆


## 微信公众号

iCat的微信公众号原本有五个账号,但现在属于我个人的就剩一个[「小王爱吃糖」](/wechatOA/)
等工作不是那么繁忙后,会将公众号处理一番。暂定为一些我觉得有价值,很重要,比较精彩的文章。后面也会同步将博客文章同步至公众号内,但并不是所有。建议所有用户订阅


## 邮件通知

邮件通知采用follow的rss更新采集通知功能,能在本博客更新后发一封邮件通知到您。当然了,这需要你留下你的邮件地址

点击上方 `邮件订阅` ,填入你的邮件地址订阅即可

## RSS订阅

你可以使用第三方RSS客户端接收到博客的文章摘要通知

https://meuicat.com/rss2.xml
  • 创建 [blogRoot]/themes/butterfly/layout/includes/page/follow.pug 页面文件,并新增以下内容
1
2
3
4
5
6
7
8
9
10
form#follow(action="https://api.follow.it/subscribe?pub=YDgVmI6K0mm9l1_CRzUY_g" method="post" target="_blank")
.follow-it-form-subscribe(style="position: relative;")
.heading
h5(style="font-weight: bold; text-align: center;") 订阅本站文章:
.input-field
input(type="email" name="email" placeholder="填入您的邮箱地址" spellcheck="false")
.submit-button
button(type="submit" onclick="ga('send','event', 'Form','Submit','Affiliate');" style="font-weight: bold; font-size: 14px; text-align: center;") 确认订阅
if is_page()
hr

follow

  • {follow的订阅id}的获取:Settings - Affiliate program - For theme creators - Set-up guide - 2.Add a subscription form

  • 列如:https://api.follow.it/subscribe?pub=YDgVmI6K0mm9l1_CRzUY_g,就是 {follow的订阅id}

更多订阅

本站已在文章页底部植入次模块功能

  • 新增 [blogRoot]/themes/butterfly/layout/post.pug 页面内容
    (**+** 号直接删除 即是正常缩进)
1
2
3
4
5
6
7
8
9
10
      ···

if (theme.post_meta.post.tags)
.post-meta__tag-list
each item, index in page.tags.data
a(href=url_for(item.path)).post-meta__tags #[=item.name]
include includes/third-party/share/index.pug
+ include includes/page/follow.pug

···