hexo-theme-particlex 2.2.1 → 2.2.3

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -150,7 +150,7 @@ highlightStyle: github # Highlight style
150
150
 
151
151
  - 页脚
152
152
 
153
- 考虑到博客部署在服务器并使用自己域名的情况,按国家规定需要在网站下边添加备案消息
153
+ 考虑到博客部署在服务器并使用自己域名的情况,按规定需要在网站下边添加备案消息
154
154
 
155
155
  如没有需要显示备案消息的可以关闭
156
156
 
@@ -1,10 +1,14 @@
1
+ <%
2
+ let posts = site.posts;
3
+ posts.data.sort((a, b) => b.date - a.date);
4
+ %>
1
5
  <div id="archives">
2
6
  <% if (theme.search.enable) { %>
3
- <div id="search-mask" style="z-index: <%= site.posts.length + 1 %>"></div>
4
- <input id="search-bar" class="ipt" placeholder="搜索" style="z-index: <%= site.posts.length + 2 %>">
7
+ <div id="search-mask" style="z-index: <%= posts.length + 1 %>"></div>
8
+ <input id="search-bar" class="ipt" placeholder="搜索" style="z-index: <%= posts.length + 2 %>">
5
9
  <% } %>
6
- <% site.posts.forEach((post, id) => { %>
7
- <div class="timeline" style="z-index: <%= site.posts.length - id %>" data-title="<%- post.title.toLowerCase().replace(/\s+/gm, "") %>">
10
+ <% posts.forEach((post, id) => { %>
11
+ <div class="timeline" style="z-index: <%= posts.length - id %>" data-title="<%- post.title.toLowerCase().replace(/\s+/gm, "") %>">
8
12
  <div class="timeline-tail"></div>
9
13
  <div class="timeline-content">
10
14
  <div class="item-time"><%- date(post.date, "YYYY/M/D") %></div>
package/layout/card.ejs CHANGED
@@ -1,7 +1,7 @@
1
1
  <div id="card-div">
2
2
  <div class="card-style" style="width: 300px">
3
3
  <div class="avatar">
4
- <img src="<%- theme.avatar %>" alt="avatar">
4
+ <img src="<%- url_for(theme.avatar) %>" alt="avatar">
5
5
  </div>
6
6
  <div class="name">
7
7
  <%= config.author %>
@@ -13,7 +13,7 @@
13
13
  <div class="icon-links">
14
14
  <% Object.keys(theme.card.iconLinks).forEach(key => { %>
15
15
  <span class="icon-link">
16
- <a href="<%- theme.card.iconLinks[key].link %>">
16
+ <a href="<%- url_for(theme.card.iconLinks[key].link) %>">
17
17
  <i class="fa-<%- theme.card.iconLinks[key].theme %> fa-<%- theme.card.iconLinks[key].name %> fa-fw"></i>
18
18
  </a>
19
19
  </span>
@@ -23,11 +23,11 @@
23
23
  <% if (Object.keys(theme.card.friendLinks).length) { %>
24
24
  <div class="friend-links">
25
25
  <% Object.keys(theme.card.friendLinks).forEach(key => { %>
26
- <span class="friend-link">
27
- <a href="<%- theme.card.friendLinks[key] %>">
26
+ <div class="friend-link">
27
+ <a href="<%- url_for(theme.card.friendLinks[key]) %>">
28
28
  <%= key %>
29
29
  </a>
30
- </span>
30
+ </div>
31
31
  <% }); %>
32
32
  </div>
33
33
  <% } %>
@@ -19,11 +19,7 @@
19
19
  <% if (is_category(category.name)) { %>
20
20
  <%
21
21
  posts = category.posts;
22
- posts.data.sort((a, b) => {
23
- if (typeof a.top === "undefined") a.top = 0;
24
- if (typeof b.top === "undefined") b.top = 0;
25
- return a.top == b.top ? b.date - a.date : b.top - a.top
26
- });
22
+ posts.data.sort((a, b) => b.date - a.date);
27
23
  %>
28
24
  <% } %>
29
25
  <% }); %>
@@ -1,10 +1,8 @@
1
1
  <div class="page-current">
2
2
  <div class="prev">
3
3
  <% if (page.current != 1) { %>
4
- <a href="<%- url_for(page.prev_link) %>">
5
- <span class="page-num">
6
- <i class="fa-solid fa-caret-left fa-fw"></i>
7
- </span>
4
+ <a class="page-num" href="<%- url_for(page.prev_link) %>">
5
+ <i class="fa-solid fa-caret-left fa-fw"></i>
8
6
  </a>
9
7
  <% } %>
10
8
  </div>
@@ -12,27 +10,21 @@
12
10
  <% if (page.current != 1) { %>
13
11
  <span>
14
12
  <% if (page.current - 3 >= 1) { %>
15
- <a href="<%- config.root %>"><span class="page-num">1</span></a>
13
+ <a class="page-num" href="<%- config.root %>">1</a>
16
14
  <span class="page-omit">...</span>
17
15
  <% } %>
18
16
  <% if (page.current - 2 >= 1) { %>
19
17
  <% if (page.current - 2 == 1) { %>
20
- <a href="<%- config.root %>">
21
- <span class="page-num">1</span>
22
- </a>
18
+ <a class="page-num" href="<%- config.root %>">1</a>
23
19
  <% } %>
24
20
  <% if (page.current - 2 != 1) { %>
25
- <a href="<%- url_for("page/" + (page.current - 2)) %>">
26
- <span class="page-num">
27
- <%= page.current - 2 %>
28
- </span>
21
+ <a class="page-num" href="<%- url_for("page/" + (page.current - 2)) %>">
22
+ <%= page.current - 2 %>
29
23
  </a>
30
24
  <% } %>
31
25
  <% } %>
32
- <a href="<%- url_for(page.prev_link) %>">
33
- <span class="page-num">
34
- <%= page.prev %>
35
- </span>
26
+ <a class="page-num" href="<%- url_for(page.prev_link) %>">
27
+ <%= page.prev %>
36
28
  </a>
37
29
  </span>
38
30
  <% } %>
@@ -41,24 +33,18 @@
41
33
  </span>
42
34
  <% if (page.current != page.total) { %>
43
35
  <span>
44
- <a href="<%- url_for(page.next_link) %>">
45
- <span class="page-num">
46
- <%= page.next %>
47
- </span>
36
+ <a class="page-num" href="<%- url_for(page.next_link) %>">
37
+ <%= page.next %>
48
38
  </a>
49
39
  <% if (page.current + 2 <= page.total) { %>
50
- <a href="<%- url_for("page/" + (page.current + 2)) %>">
51
- <span class="page-num">
52
- <%= page.current + 2 %>
53
- </span>
40
+ <a class="page-num" href="<%- url_for("page/" + (page.current + 2)) %>">
41
+ <%= page.current + 2 %>
54
42
  </a>
55
43
  <% } %>
56
44
  <% if (page.current + 3 <= page.total) { %>
57
45
  <span class="page-omit">...</span>
58
- <a href="<%- url_for("page/" + page.total) %>">
59
- <span class="page-num">
60
- <%= page.total %>
61
- </span>
46
+ <a class="page-num" href="<%- url_for("page/" + page.total) %>">
47
+ <%= page.total %>
62
48
  </a>
63
49
  <% } %>
64
50
  </span>
@@ -66,10 +52,8 @@
66
52
  </div>
67
53
  <div class="next">
68
54
  <% if (page.current != page.total) { %>
69
- <a href="<%- url_for(page.next_link) %> ">
70
- <span class="page-num">
71
- <i class="fa-solid fa-caret-right fa-fw"></i>
72
- </span>
55
+ <a class="page-num" href="<%- url_for(page.next_link) %> ">
56
+ <i class="fa-solid fa-caret-right fa-fw"></i>
73
57
  </a>
74
58
  <% } %>
75
59
  </div>
package/layout/layout.ejs CHANGED
@@ -20,11 +20,6 @@
20
20
  else if (is_archive() || is_year() || is_month())
21
21
  title = "Archives | ";
22
22
  title += config.title;
23
- site.posts.data.sort((a, b) => {
24
- if (typeof a.top === "undefined") a.top = 0;
25
- if (typeof b.top === "undefined") b.top = 0;
26
- return a.top == b.top ? b.date - a.date : b.top - a.top;
27
- });
28
23
  %>
29
24
  <!DOCTYPE html>
30
25
  <html lang="<%- config.language %>">
@@ -35,7 +30,7 @@
35
30
  <meta name="author" content="<%- config.author %>">
36
31
  <meta name="description" content="<%- config.description %>">
37
32
  <meta name="keywords" content="<%- config.keywords %>">
38
- <link rel="icon" href="<%- theme.avatar %>">
33
+ <link rel="icon" href="<%- url_for(theme.avatar) %>">
39
34
  <script src="https://cdn.staticfile.org/vue/3.2.45/vue.global.prod.min.js"></script>
40
35
  <script src="https://cdn.staticfile.org/highlight.js/11.7.0/highlight.min.js"></script>
41
36
  <link rel="stylesheet" href="https://cdn.staticfile.org/highlight.js/11.7.0/styles/<%- theme.highlightStyle %>.min.css">
@@ -58,15 +53,15 @@
58
53
  <%- partial("loading") %>
59
54
  <div id="layout">
60
55
  <transition name="into">
61
- <div v-show="showpage" style="display: -not-none">
62
- <div id="menushow">
63
- <%- partial("menu") %>
64
- </div>
65
- <div id="main">
66
- <%- partial(type) %>
67
- <%- partial("footer") %>
68
- </div>
56
+ <div v-show="showpage" style="display: -not-none">
57
+ <div id="menushow">
58
+ <%- partial("menu") %>
69
59
  </div>
60
+ <div id="main">
61
+ <%- partial(type) %>
62
+ <%- partial("footer") %>
63
+ </div>
64
+ </div>
70
65
  </transition>
71
66
  <div id="showimg">
72
67
  <img id="showimg-content" alt="showimg">
@@ -5,7 +5,7 @@
5
5
  <h2>LOADING...</h2>
6
6
  <p style="word-break: keep-all">加载过慢请开启缓存(浏览器默认开启)</p>
7
7
  <div>
8
- <img alt="loading" src="<%- url_for("/loading.gif") %>" style="width: 60px">
8
+ <img alt="loading" src="<%- url_for("/images/loading.gif") %>" style="height: 50px">
9
9
  </div>
10
10
  </div>
11
11
  </div>
package/layout/posts.ejs CHANGED
@@ -1,5 +1,13 @@
1
- <% let current = (page.current - 1) * config.index_generator.per_page; %>
2
- <% site.posts.slice(0 + current, config.index_generator.per_page + current).forEach(post => { %>
1
+ <%
2
+ let posts = site.posts,
3
+ current = (page.current - 1) * config.index_generator.per_page;
4
+ posts.data.sort((a, b) => {
5
+ let topa = a.top ?? 0, topb = b.top ?? 0;
6
+ return topa == topb ? b.date - a.date : topb - topa;
7
+ });
8
+ posts = posts.slice(current, config.index_generator.per_page + current);
9
+ %>
10
+ <% posts.forEach(post => { %>
3
11
  <div class="post">
4
12
  <a href="<%- url_for(post.path) %>">
5
13
  <h2 class="post-title"><%= titlecase(post.title) %></h2>
@@ -21,6 +29,16 @@
21
29
  </span>
22
30
  <%- date(post.date, "YYYY/M/D") %>
23
31
  </span>
32
+ <% if (theme.crypto.enable && typeof post.password !== "undefined") { %>
33
+ <span class="special">
34
+ <i class="fa-solid fa-lock fa-fw"></i>
35
+ </span>
36
+ <% } %>
37
+ <% if (typeof post.top !== "undefined" && post.top > 0) { %>
38
+ <span class="special">
39
+ <i class="fa-solid fa-grip-vertical fa-fw"></i>
40
+ </span>
41
+ <% } %>
24
42
  </div>
25
43
  <div class="excerpt">
26
44
  <div class="content" v-pre>
package/layout/tags.ejs CHANGED
@@ -19,11 +19,7 @@
19
19
  <% if (is_tag(tag.name)) { %>
20
20
  <%
21
21
  posts = tag.posts;
22
- posts.data.sort((a, b) => {
23
- if (typeof a.top === "undefined") a.top = 0;
24
- if (typeof b.top === "undefined") b.top = 0;
25
- return a.top == b.top ? b.date - a.date : b.top - a.top;
26
- });
22
+ posts.data.sort((a, b) => b.date - a.date);
27
23
  %>
28
24
  <% } %>
29
25
  <% }); %>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-particlex",
3
- "version": "2.2.1",
3
+ "version": "2.2.3",
4
4
  "description": "A concise Hexo theme, based on Particle.",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"