hexo-theme-nblog 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/publish.yml +0 -1
- package/_config.yml +93 -77
- package/layout/category.ejs +82 -71
- package/layout/friends.ejs +45 -31
- package/layout/index.ejs +167 -95
- package/layout/layout.ejs +141 -48
- package/layout/post.ejs +2 -1
- package/package.json +7 -3
- package/scripts/helpers.js +33 -1
- package/source/css/lazyload.css +169 -0
- package/source/css/main.css +210 -8
- package/source/css/markdown.css +25 -13
- package/source/js/lazyload.js +182 -0
- package/source/js/main.js +239 -3
package/_config.yml
CHANGED
|
@@ -1,77 +1,93 @@
|
|
|
1
|
-
#! 注意! 为了更新 npm package 后你的数据不会丢失
|
|
2
|
-
#! 请将此文件复制到根目录并重命名为 `_config.nblog.yml`
|
|
3
|
-
default_license: CC BY-NC-SA 4.0
|
|
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
|
-
- name:
|
|
62
|
-
path: /posts/
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
1
|
+
#! 注意! 为了更新 npm package 后你的数据不会丢失
|
|
2
|
+
#! 请将此文件复制到根目录并重命名为 `_config.nblog.yml` 并在此文件的基础上进行站点配置
|
|
3
|
+
default_license: CC BY-NC-SA 4.0
|
|
4
|
+
|
|
5
|
+
primary_color: '#FF7F78'
|
|
6
|
+
|
|
7
|
+
site_name: My Blog
|
|
8
|
+
author: Your Name
|
|
9
|
+
avatar: /images/avatar.png
|
|
10
|
+
bio: 这里是你的个人简介
|
|
11
|
+
social:
|
|
12
|
+
- platform: GitHub
|
|
13
|
+
url: https://github.com/yourusername
|
|
14
|
+
icon: '<svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor"><path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"/></svg>'
|
|
15
|
+
- platform: Email
|
|
16
|
+
url: mailto:your@email.com
|
|
17
|
+
icon: '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"></path><polyline points="22,6 12,13 2,6"></polyline></svg>'
|
|
18
|
+
|
|
19
|
+
nav_links:
|
|
20
|
+
- name: 首页
|
|
21
|
+
path: /
|
|
22
|
+
icon: '<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"></path><polyline points="9 22 9 12 15 12 15 22"></polyline></svg>'
|
|
23
|
+
- name: 分类
|
|
24
|
+
path: /categories/
|
|
25
|
+
icon: '<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"></path></svg>'
|
|
26
|
+
- name: 标签
|
|
27
|
+
path: /tags/
|
|
28
|
+
icon: '<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"></path><line x1="7" y1="7" x2="7.01" y2="7"></line></svg>'
|
|
29
|
+
- name: 归档
|
|
30
|
+
path: /archives/
|
|
31
|
+
icon: '<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect><line x1="16" y1="2" x2="16" y2="6"></line><line x1="8" y1="2" x2="8" y2="6"></line><line x1="3" y1="10" x2="21" y2="10"></line></svg>'
|
|
32
|
+
- name: 友链
|
|
33
|
+
path: /friends/
|
|
34
|
+
icon: '<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>'
|
|
35
|
+
|
|
36
|
+
friend_links:
|
|
37
|
+
simple:
|
|
38
|
+
- name: Cloudflare
|
|
39
|
+
url: https://cloudflare.com
|
|
40
|
+
avatar: https://www.cloudflare.com/img/logo-cloudflare-dark.svg
|
|
41
|
+
description: Security, Performance, Reliability
|
|
42
|
+
- name: Hexo
|
|
43
|
+
url: https://hexo.io
|
|
44
|
+
avatar: https://hexo.io/logo.svg
|
|
45
|
+
description: A fast, simple & powerful blog framework
|
|
46
|
+
# cover:
|
|
47
|
+
# - name: Cloudflare Blog
|
|
48
|
+
# url: https://cloudflare.com
|
|
49
|
+
# avatar: https://www.cloudflare.com/img/logo-cloudflare-dark.svg
|
|
50
|
+
# cover: https://images.unsplash.com/photo-1555066931-4365d14bab8c?w=600
|
|
51
|
+
# author: Cloudflare
|
|
52
|
+
# description: Security, Performance, Reliability for the modern web
|
|
53
|
+
# - name: Hexo Blog
|
|
54
|
+
# url: https://hexo.io
|
|
55
|
+
# avatar: https://hexo.io/logo.svg
|
|
56
|
+
# cover: https://images.unsplash.com/photo-1461749280684-dccba630e2f6?w=600
|
|
57
|
+
# author: Hexo
|
|
58
|
+
# description: A fast, simple & powerful blog framework powered by Node.js
|
|
59
|
+
|
|
60
|
+
footer_links:
|
|
61
|
+
- name: 隐私政策
|
|
62
|
+
path: /posts/privacy/
|
|
63
|
+
- name: 版权协议
|
|
64
|
+
path: /posts/copyright/
|
|
65
|
+
|
|
66
|
+
posts_per_page: 10
|
|
67
|
+
|
|
68
|
+
twikoo:
|
|
69
|
+
enable: false
|
|
70
|
+
envId: https://xxx
|
|
71
|
+
|
|
72
|
+
katex:
|
|
73
|
+
enable: true
|
|
74
|
+
|
|
75
|
+
pjax:
|
|
76
|
+
enable: true
|
|
77
|
+
|
|
78
|
+
canonical:
|
|
79
|
+
enable: true
|
|
80
|
+
|
|
81
|
+
medium_zoom:
|
|
82
|
+
enable: true
|
|
83
|
+
margin: 24
|
|
84
|
+
|
|
85
|
+
lazyload:
|
|
86
|
+
enable: true
|
|
87
|
+
placeholder: blur
|
|
88
|
+
|
|
89
|
+
notifications:
|
|
90
|
+
enable: true
|
|
91
|
+
interval: 10000
|
|
92
|
+
items:
|
|
93
|
+
- message: '欢迎访问我的博客!'
|
package/layout/category.ejs
CHANGED
|
@@ -1,76 +1,87 @@
|
|
|
1
|
-
<% if (page.posts && page.posts.length
|
|
2
|
-
<div class="category-posts-page container">
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
<% if (page.posts && page.posts.length> 0) { %>
|
|
2
|
+
<div class="category-posts-page container">
|
|
3
|
+
<div class="page-header animate-fade-in-up">
|
|
4
|
+
<h1 class="page-header__title">
|
|
5
|
+
<svg width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
6
|
+
<path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"></path>
|
|
7
|
+
</svg>
|
|
8
|
+
分类: <%= page.category %>
|
|
9
|
+
</h1>
|
|
10
|
+
<p class="page-header__description">共 <%= page.posts.length %> 篇文章</p>
|
|
11
|
+
<a href="<%= url_for('/categories/') %>" class="page-header__back">
|
|
12
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
13
|
+
<polyline points="15 18 9 12 15 6"></polyline>
|
|
14
|
+
</svg>
|
|
15
|
+
返回分类列表
|
|
16
|
+
</a>
|
|
17
|
+
</div>
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
19
|
+
<div class="posts-list animate-fade-in-up animate-delay-1">
|
|
20
|
+
<% page.posts.each(function(post) { %>
|
|
21
|
+
<article class="post-card material-card">
|
|
22
|
+
<a href="<%= url_for(post.path) %>" class="post-card__link">
|
|
23
|
+
<div class="post-card__cover">
|
|
24
|
+
<% if (post.cover) { %>
|
|
25
|
+
<img src="<%= post.cover %>" alt="<%= post.title %>" loading="lazy">
|
|
26
|
+
<% } else { %>
|
|
27
|
+
<div class="post-card__cover-placeholder"></div>
|
|
28
|
+
<% } %>
|
|
29
|
+
<div class="post-card__overlay"></div>
|
|
30
|
+
<div class="post-card__info">
|
|
31
|
+
<div class="post-card__meta">
|
|
32
|
+
<span class="post-card__date">
|
|
33
|
+
<%= date(post.date, 'YYYY-MM-DD' ) %>
|
|
34
|
+
</span>
|
|
35
|
+
<% if (post.categories && post.categories.length> 0) { %>
|
|
36
|
+
<span class="post-card__category">
|
|
37
|
+
<%= post.categories.toArray()[0].name %>
|
|
38
|
+
</span>
|
|
39
|
+
<% } %>
|
|
40
|
+
</div>
|
|
41
|
+
<h2 class="post-card__title">
|
|
42
|
+
<%= post.title %>
|
|
43
|
+
</h2>
|
|
44
|
+
</div>
|
|
38
45
|
</div>
|
|
39
|
-
</
|
|
40
|
-
</
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
</div>
|
|
44
|
-
</div>
|
|
45
|
-
<% } else { %>
|
|
46
|
-
<div class="categories-page container">
|
|
47
|
-
<div class="page-header animate-fade-in-up">
|
|
48
|
-
<h1 class="page-header__title">
|
|
49
|
-
<svg width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
50
|
-
<path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"></path>
|
|
51
|
-
</svg>
|
|
52
|
-
分类
|
|
53
|
-
</h1>
|
|
54
|
-
<p class="page-header__description">共 <%= site.categories.length %> 个分类</p>
|
|
46
|
+
</a>
|
|
47
|
+
</article>
|
|
48
|
+
<% }); %>
|
|
49
|
+
</div>
|
|
55
50
|
</div>
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
<svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
51
|
+
<% } else { %>
|
|
52
|
+
<div class="categories-page container">
|
|
53
|
+
<div class="page-header animate-fade-in-up">
|
|
54
|
+
<h1 class="page-header__title">
|
|
55
|
+
<svg width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
62
56
|
<path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"></path>
|
|
63
57
|
</svg>
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
</
|
|
76
|
-
|
|
58
|
+
分类
|
|
59
|
+
</h1>
|
|
60
|
+
<p class="page-header__description">共 <%= site.categories.length %> 个分类</p>
|
|
61
|
+
</div>
|
|
62
|
+
|
|
63
|
+
<div class="categories-grid animate-fade-in-up animate-delay-1">
|
|
64
|
+
<% site.categories.sort('name').forEach(function(category) { %>
|
|
65
|
+
<a href="<%= url_for(category.path) %>" class="category-card material-card">
|
|
66
|
+
<div class="category-card__icon">
|
|
67
|
+
<svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
68
|
+
<path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"></path>
|
|
69
|
+
</svg>
|
|
70
|
+
</div>
|
|
71
|
+
<div class="category-card__content">
|
|
72
|
+
<h3 class="category-card__name">
|
|
73
|
+
<%= category.name %>
|
|
74
|
+
</h3>
|
|
75
|
+
<span class="category-card__count">
|
|
76
|
+
<%= category.length %> 篇文章
|
|
77
|
+
</span>
|
|
78
|
+
</div>
|
|
79
|
+
<svg class="category-card__arrow" width="20" height="20" viewBox="0 0 24 24" fill="none"
|
|
80
|
+
stroke="currentColor" stroke-width="2">
|
|
81
|
+
<polyline points="9 18 15 12 9 6"></polyline>
|
|
82
|
+
</svg>
|
|
83
|
+
</a>
|
|
84
|
+
<% }); %>
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
<% } %>
|
package/layout/friends.ejs
CHANGED
|
@@ -8,50 +8,64 @@
|
|
|
8
8
|
<%= page.title %>
|
|
9
9
|
</h1>
|
|
10
10
|
<% if (page.description) { %>
|
|
11
|
-
<p class="page-header__description"
|
|
12
|
-
|
|
11
|
+
<p class="page-header__description">
|
|
12
|
+
<%= page.description %>
|
|
13
|
+
</p>
|
|
14
|
+
<% } %>
|
|
13
15
|
</div>
|
|
14
16
|
|
|
15
17
|
<div class="page-content animate-fade-in-up animate-delay-1">
|
|
16
|
-
<% if (theme.friend_links && theme.friend_links.simple && theme.friend_links.simple.length
|
|
18
|
+
<% if (theme.friend_links && theme.friend_links.simple && theme.friend_links.simple.length> 0) { %>
|
|
17
19
|
<div class="friends-grid">
|
|
18
20
|
<% theme.friend_links.simple.forEach(function(friend) { %>
|
|
19
21
|
<a href="<%= friend.url %>" target="_blank" rel="noopener" class="friend-card material-card">
|
|
20
22
|
<div class="friend-card__avatar">
|
|
21
|
-
<img src="<%= friend.avatar %>" alt="<%= friend.name %>"
|
|
23
|
+
<img data-src="<%= friend.avatar %>" alt="<%= friend.name %>">
|
|
22
24
|
</div>
|
|
23
25
|
<div class="friend-card__content">
|
|
24
|
-
<h3 class="friend-card__name"
|
|
25
|
-
|
|
26
|
+
<h3 class="friend-card__name">
|
|
27
|
+
<%= friend.name %>
|
|
28
|
+
</h3>
|
|
29
|
+
<p class="friend-card__description">
|
|
30
|
+
<%= friend.description %>
|
|
31
|
+
</p>
|
|
26
32
|
</div>
|
|
27
33
|
</a>
|
|
28
|
-
|
|
34
|
+
<% }); %>
|
|
29
35
|
</div>
|
|
30
|
-
|
|
36
|
+
<% } %>
|
|
31
37
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
<div class="friend-card__content">
|
|
41
|
-
<div class="friend-card__avatar-wrapper">
|
|
42
|
-
<div class="friend-card__avatar">
|
|
43
|
-
<img src="<%= friend.avatar %>" alt="<%= friend.name %>" loading="lazy">
|
|
38
|
+
<% if (theme.friend_links && theme.friend_links.cover && theme.friend_links.cover.length> 0) { %>
|
|
39
|
+
<div class="friends-grid"
|
|
40
|
+
style="grid-template-columns: repeat(3, 1fr); <% if (theme.friend_links.simple && theme.friend_links.simple.length > 0) { %>margin-top: 24px;<% } %>">
|
|
41
|
+
<% theme.friend_links.cover.forEach(function(friend) { %>
|
|
42
|
+
<a href="<%= friend.url %>" target="_blank" rel="noopener"
|
|
43
|
+
class="friend-card friend-card--cover material-card">
|
|
44
|
+
<div class="friend-card__cover">
|
|
45
|
+
<img data-src="<%= friend.cover %>" alt="<%= friend.name %>">
|
|
44
46
|
</div>
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
47
|
+
<div class="friend-card__overlay"></div>
|
|
48
|
+
<div class="friend-card__content">
|
|
49
|
+
<div class="friend-card__avatar-wrapper">
|
|
50
|
+
<div class="friend-card__avatar">
|
|
51
|
+
<img data-src="<%= friend.avatar %>" alt="<%= friend.name %>">
|
|
52
|
+
</div>
|
|
53
|
+
<span class="friend-card__author">
|
|
54
|
+
<%= friend.author || friend.name %>
|
|
55
|
+
</span>
|
|
56
|
+
</div>
|
|
57
|
+
<h3 class="friend-card__name">
|
|
58
|
+
<%= friend.name %>
|
|
59
|
+
</h3>
|
|
60
|
+
<p class="friend-card__description">
|
|
61
|
+
<%= friend.description %>
|
|
62
|
+
</p>
|
|
63
|
+
</div>
|
|
64
|
+
</a>
|
|
65
|
+
<% }); %>
|
|
66
|
+
</div>
|
|
67
|
+
<% } %>
|
|
54
68
|
|
|
55
|
-
|
|
69
|
+
<%- page.content %>
|
|
56
70
|
</div>
|
|
57
|
-
</div>
|
|
71
|
+
</div>
|