hexo-theme-particlex 2.1.0 → 2.1.1

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/README.md CHANGED
@@ -139,7 +139,7 @@ highlightStyle: github # Highlight style
139
139
 
140
140
  一般来说,缩略展示文档只需要在文档中添加 `<!-- more -->` 即可,缩略内容在显示全文中也会出现
141
141
 
142
- 但考虑到不想把缩略内容放在正文里,就添加了此参数,在 Front-Matter 里设置
142
+ 但考虑到不想把缩略内容放在正文里,就添加了此参数,在 [Front-Matter](https://hexo.io/zh-cn/docs/front-matter) 里设置
143
143
 
144
144
  支持 Markdown 格式
145
145
 
@@ -184,9 +184,13 @@ highlightStyle: github # Highlight style
184
184
  enable: false
185
185
  ```
186
186
 
187
+ - 文章置顶
188
+
189
+ 在 [Front-Matter](https://hexo.io/zh-cn/docs/front-matter) 里设置 `top` 作为置顶参数,越大越靠前,默认为 0
190
+
187
191
  - 文章加密
188
192
 
189
- 使用 AES 加密算法,在 Front-Matter 里设置 `password` 作为密码,**使用请安装插件 [Hexo-Helper-Crypto](https://github.com/argvchs/hexo-helper-crypto)**
193
+ 使用 AES 加密算法,在 [Front-Matter](https://hexo.io/zh-cn/docs/front-matter) 里设置 `password` 作为密码,**使用请安装插件 [Hexo-Helper-Crypto](https://github.com/argvchs/hexo-helper-crypto)**
190
194
 
191
195
  ```yaml
192
196
  crypto:
@@ -16,7 +16,16 @@
16
16
  <%= category.name %>
17
17
  </a>
18
18
  </span>
19
- <% if (is_category(category.name)) { posts = category.posts; } %><% }); %>
19
+ <% if (is_category(category.name)) { %>
20
+ <%
21
+ posts = category.posts;
22
+ posts.data.sort((a, b) => {
23
+ a.top ??= 0, b.top ??= 0;
24
+ return a.top == b.top ? b.date - a.date : b.top - a.top
25
+ });
26
+ %>
27
+ <% } %>
28
+ <% }); %>
20
29
  </div>
21
30
  <% posts.forEach(post => { %>
22
31
  <div class="timeline">
package/layout/layout.ejs CHANGED
@@ -20,7 +20,10 @@
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) => b.date - a.date);
23
+ site.posts.data.sort((a, b) => {
24
+ a.top ??= 0, b.top ??= 0;
25
+ return a.top == b.top ? b.date - a.date : b.top - a.top
26
+ });
24
27
  %>
25
28
  <!DOCTYPE html>
26
29
  <html lang="<%- config.language %>">
package/layout/tags.ejs CHANGED
@@ -16,7 +16,16 @@
16
16
  <%= tag.name %>
17
17
  </a>
18
18
  </span>
19
- <% if (is_tag(tag.name)) { posts = tag.posts; } %><% }); %>
19
+ <% if (is_tag(tag.name)) { %>
20
+ <%
21
+ posts = tag.posts;
22
+ posts.data.sort((a, b) => {
23
+ a.top ??= 0, b.top ??= 0;
24
+ return a.top == b.top ? b.date - a.date : b.top - a.top
25
+ });
26
+ %>
27
+ <% } %>
28
+ <% }); %>
20
29
  </div>
21
30
  <% posts.forEach(post => { %>
22
31
  <div class="timeline">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-particlex",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "A concise Hexo theme, based on Particle.",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"