安装插件

1
npm i hexo-douban

配置插件

_config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
douban:
id: 270559401
builtin: true
dynamic: false
item_per_page: 10
meta_max_line: 4
customize_layout: page
swup: false
book:
path: books/index.html
title: "书籍"
option:
type: "banner"
cover: https://7.isyangs.cn/66/67551f287e10e-66.webp
leftend: 读书使我充实,人生亦如此。

应用自定义样式

在根目录 source 文件夹 中新建 css/custom.css 文件

custom.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
#idouban {
display: flex;
flex-wrap: wrap;
gap: .5rem;
flex-direction: row;
}

#idouban .idouban-comment {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
text-overflow: ellipsis;
}

#idouban .idouban-item {
position: relative;
width: calc(100% / 4 - .8rem / 2);
border-radius: 12px;
border: var(--style-border);
box-shadow: var(--efu-shadow-border);
background: var(--efu-card-bg);
transition: 0.3s;
animation: slide-in 0.6s 0.3s backwards;
border: var(--style-border);
height: 160px;
min-height: 160px !important;
overflow: hidden;
}

@media screen and (max-width: 1200px) {
#idouban .idouban-item {
width: calc(100% / 3 - .7rem / 2);
}
}

@media screen and (max-width: 899px) {
#idouban .idouban-item {
width: calc(100% / 2 - .5rem / 2);
}
}

@media screen and (max-width: 600px) {
#idouban .idouban-item {
width: 100%;
}
}

#idouban .idouban-item:hover {
border-color: var(--efu-main);
}

#idouban .idouban-item .idouban-picture {
width: 120px;
height: 100%;
top: 0;
padding: 10px;
}

#idouban .idouban-item .idouban-picture img {
margin: 0;
height: 100%;
max-width: 100%;
border-radius: 6px;
}

#idouban .idouban-item .idouban-info {
display: flex;
flex-wrap: wrap;
align-content: flex-start;
height: 100%;
position: relative;
}

#idouban .idouban-item .idouban-info .idouban-rating {
position: absolute;
bottom: 5px;
line-height: 16px;
}

#idouban .idouban-item .idouban-info .idouban-meta {
display: -webkit-box;
overflow: hidden;
-webkit-box-orient: vertical;
}

@media screen and (max-width: 1300px) {
#idouban .idouban-item .idouban-info .idouban-meta {
-webkit-line-clamp: 3 !important;
}
}

@media screen and (max-width: 899px) {
#idouban .idouban-item .idouban-info .idouban-meta {
-webkit-line-clamp: 4 !important;
}
}

#idouban .idouban-item .idouban-info > div {
width: 100%;
}

#idouban .idouban-item .idouban-info > div a {
transition: all 0.2s ease 0s;
white-space: nowrap;
overflow: hidden;
display: block;
text-overflow: ellipsis;
width: 100%;
}

#idouban .idouban-item .idouban-info > div a {
border-bottom: 0;
}

#idouban .idouban-item .idouban-info > div a:hover {
background: none;
color: var(--efu-main);
}

.idouban-pagination {
margin-top: .5rem !important;
margin-bottom: .5rem !important;
animation: slide-in 0.6s 0.3s backwards;
display: flex;
gap: .5rem;
justify-content: center;
align-items: center;
}

.idouban-pagination .idouban-button {
background: var(--efu-card-bg);
height: 2rem;
line-height: calc(2rem - 2px);
border-radius: 8px !important;
margin: 0;
padding: 6px 12px !important;
box-shadow: var(--efu-shadow-border);
border: var(--style-border);
transition: 0.3s;
display: inline-flex;
align-items: center;
}

.idouban-pagination .idouban-button:hover {
background: var(--efu-main);
border: var(--style-border) !important;
}

.idouban-tabs {
white-space: nowrap;
overflow: hidden;
display: flex;
gap: .5rem;
width: 100%;
padding: 0.4rem 1rem 0.4rem 1rem;
background: var(--efu-card-bg);
border-radius: 12px;
border: var(--style-border);
animation: slide-in 0.6s 0.3s backwards;
transition: 0.3s;
margin-bottom: 0 !important;
margin-top: 0 !important;
}

.idouban-tabs:hover {
border-color: var(--efu-main);
transition: .3s;
}

.idouban-tabs a {
padding: 0.1rem 0.5rem !important;
font-weight: 700;
border-radius: 8px !important;
border-bottom: 0;
}

.idouban-tabs .idouban-tab-active {
background: var(--efu-main);
}

.idouban-pagination {
width: 100%;
}

引用到页面

_config.solitude.yml
1
2
3
4
5
6
7
8
9
10
11
extends:
# Insert in head
# 插入到 head
head:
# - <script src="https://cdn.bootcdn.net/ajax/libs/pace/1.2.4/pace.min.js"></script>
- <link rel="stylesheet" href="/solitude-demo/css/custom.css">

# Insert in body
# 插入到 body
body:
# - <script src="https://cdn.bootcdn.net/ajax/libs/pace/1.2.4/pace.min.js"></script>

预览