hexo-theme-volantis 6.0.0 → 6.0.2
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/CHANGELOG.md +15 -0
- package/layout/_partial/article.ejs +8 -8
- package/layout/_partial/post.ejs +3 -3
- package/layout/_partial/scripts/global.ejs +1 -2
- package/layout/_widget/blogger.ejs +4 -4
- package/package.json +1 -1
- package/scripts/helpers/head/generate_seo.js +13 -1
- package/scripts/helpers/head/generate_title__keywords__description.js +10 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [6.0.2](https://github.com/volantis-x/hexo-theme-volantis/compare/v6.0.1...v6.0.2) (2025-11-21)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* offsetHeight ([746201a](https://github.com/volantis-x/hexo-theme-volantis/commit/746201af1da5afa04800d8d83dfeb014b87014d7))
|
|
9
|
+
* remove noarchive ([dc40369](https://github.com/volantis-x/hexo-theme-volantis/commit/dc403691071a07cb433de34becdb0d35e59c9afa))
|
|
10
|
+
|
|
11
|
+
## [6.0.1](https://github.com/volantis-x/hexo-theme-volantis/compare/v6.0.0...v6.0.1) (2025-11-17)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* escape_html & strip_html ([#964](https://github.com/volantis-x/hexo-theme-volantis/issues/964)) ([2c9b4b0](https://github.com/volantis-x/hexo-theme-volantis/commit/2c9b4b00df3dcd73d1337fbf6abcc63695b824ca))
|
|
17
|
+
|
|
3
18
|
## [6.0.0](https://github.com/volantis-x/hexo-theme-volantis/compare/6.0.0...v5.8.1) (2025-11-14)
|
|
4
19
|
|
|
5
20
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<article itemscope itemtype="http://schema.org/Article" class="article post white-box reveal md <%- theme.custom_css.body.effect.join(' ') %> article-type-<%= post.layout %>" id="<%= post.layout %>" itemscope itemprop="blogPost">
|
|
2
2
|
<link itemprop="mainEntityOfPage" href="<%- decodeURI(post.permalink) %>">
|
|
3
3
|
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
|
|
4
|
-
<meta itemprop="name" content="<%- config.title %>">
|
|
4
|
+
<meta itemprop="name" content="<%- escape_html(strip_html(config.title)) %>">
|
|
5
5
|
</span>
|
|
6
6
|
<span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
|
|
7
|
-
<meta itemprop="name" content="<%- post.title || post.seo_title || config.title %>">
|
|
8
|
-
<meta itemprop="description" content="<%- post.description || config.description %>">
|
|
7
|
+
<meta itemprop="name" content="<%- escape_html(strip_html(post.title || post.seo_title || config.title)) %>">
|
|
8
|
+
<meta itemprop="description" content="<%- escape_html(strip_html(post.description || config.description)) %>">
|
|
9
9
|
</span>
|
|
10
10
|
<%- partial('meta', {post: post, position: 'top'}) %>
|
|
11
11
|
<div id="layoutHelper-page-plugins"></div>
|
|
@@ -137,10 +137,10 @@
|
|
|
137
137
|
site.pages.each(function(p){
|
|
138
138
|
if ((p.title || p.seo_title) && p.path && (p.group == post.group)) {
|
|
139
139
|
if (p.order < post.order && (p.order > prev.order || prev.order == undefined)) {
|
|
140
|
-
prev = {title: p.title || p.seo_title, exp: truncate(strip_html(p.content), {length: 100}), path: p.path, order: p.order};
|
|
140
|
+
prev = {title: strip_html(p.title || p.seo_title), exp: p.description ? strip_html(p.description) : truncate(strip_html(p.content), {length: 100}), path: p.path, order: p.order};
|
|
141
141
|
}
|
|
142
142
|
if (p.order > post.order && (p.order < next.order || next.order == undefined)) {
|
|
143
|
-
next = {title: p.title || p.seo_title, exp: truncate(strip_html(p.content), {length: 100}), path: p.path, order: p.order};
|
|
143
|
+
next = {title: strip_html(p.title || p.seo_title), exp: p.description ? strip_html(p.description) : truncate(strip_html(p.content), {length: 100}), path: p.path, order: p.order};
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
})
|
|
@@ -168,13 +168,13 @@
|
|
|
168
168
|
<% if (post.prev) { %>
|
|
169
169
|
<a class='prev' href='<%- url_for(post.prev.path) %>'>
|
|
170
170
|
<p class='title'><i class="fa-solid fa-chevron-left" aria-hidden="true"></i><%- post.prev.title || post.prev.seo_title || date(post.date, theme.article.body.meta_library.date.format) %></p>
|
|
171
|
-
<p class='content'><%- truncate(strip_html(page.prev.content), {length: 100}) %></p>
|
|
171
|
+
<p class='content'><%- page.prev.description ? strip_html(page.prev.description) : truncate(strip_html(page.prev.content), {length: 100}) %></p>
|
|
172
172
|
</a>
|
|
173
173
|
<% } %>
|
|
174
174
|
<% if (post.next) { %>
|
|
175
175
|
<a class='next' href='<%- url_for(post.next.path) %>'>
|
|
176
|
-
<p class='title'><%- post.next.title || post.next.seo_title || date(post.date, theme.article.body.meta_library.date.format) %><i class="fa-solid fa-chevron-right" aria-hidden="true"></i></p>
|
|
177
|
-
<p class='content'><%- truncate(strip_html(page.next.content), {length: 100}) %></p>
|
|
176
|
+
<p class='title'><%- strip_html(post.next.title || post.next.seo_title || date(post.date, theme.article.body.meta_library.date.format)) %><i class="fa-solid fa-chevron-right" aria-hidden="true"></i></p>
|
|
177
|
+
<p class='content'><%- page.next.description ? strip_html(page.next.description) : truncate(strip_html(page.next.content), {length: 100}) %></p>
|
|
178
178
|
</a>
|
|
179
179
|
<% } %>
|
|
180
180
|
</div>
|
package/layout/_partial/post.ejs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<div class="post post-v3 white-box reveal <%- theme.custom_css.body.effect.join(' ') %>" itemscope itemtype="http://schema.org/Article" >
|
|
2
2
|
<link itemprop="mainEntityOfPage" href="<%- decodeURI(post.permalink) %>">
|
|
3
3
|
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
|
|
4
|
-
<meta itemprop="name" content="<%- config.title %>">
|
|
4
|
+
<meta itemprop="name" content="<%- escape_html(strip_html(config.title)) %>">
|
|
5
5
|
</span>
|
|
6
6
|
<span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
|
|
7
|
-
<meta itemprop="name" content="<%- post.title || post.seo_title || config.title %>">
|
|
8
|
-
<meta itemprop="description" content="<%- post.description || config.description %>">
|
|
7
|
+
<meta itemprop="name" content="<%- escape_html(strip_html(post.title || post.seo_title || config.title)) %>">
|
|
8
|
+
<meta itemprop="description" content="<%- escape_html(strip_html(post.description || config.description)) %>">
|
|
9
9
|
</span>
|
|
10
10
|
<%
|
|
11
11
|
let showPin = false;
|
|
@@ -120,7 +120,6 @@
|
|
|
120
120
|
volantis.EventListener.list.forEach(function (i) {
|
|
121
121
|
i.ele.removeEventListener(i.type, i.f, false)
|
|
122
122
|
})
|
|
123
|
-
volantis.EventListener.list = null;
|
|
124
123
|
volantis.EventListener.list = [];
|
|
125
124
|
}
|
|
126
125
|
/******************** volantis.dom.$ ********************************/
|
|
@@ -404,7 +403,7 @@
|
|
|
404
403
|
)
|
|
405
404
|
}
|
|
406
405
|
volantis.scroll.offsetHeight = function () {
|
|
407
|
-
return Math.
|
|
406
|
+
return Math.min(
|
|
408
407
|
document.body.offsetHeight,
|
|
409
408
|
document.documentElement.offsetHeight,
|
|
410
409
|
document.body.clientHeight,
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
<% if (item.avatar) { %>
|
|
5
5
|
<% if (item.url) { %>
|
|
6
6
|
<a class='avatar flat-box <%- item.shape %>' href='<%- url_for(item.url) %>'>
|
|
7
|
-
<img no-lazy src='<%- item.avatar %>'/>
|
|
7
|
+
<img no-lazy src='<%- item.avatar %>' alt='avatar' />
|
|
8
8
|
</a>
|
|
9
9
|
<% } else { %>
|
|
10
10
|
<div class='avatar'>
|
|
11
|
-
<img no-lazy src='<%- item.avatar %>'/>
|
|
11
|
+
<img no-lazy src='<%- item.avatar %>' alt='avatar' />
|
|
12
12
|
</div>
|
|
13
13
|
<% } %>
|
|
14
14
|
<% } %>
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
target="_blank"
|
|
36
36
|
rel="external nofollow noopener noreferrer">
|
|
37
37
|
<% if (value.img) { %>
|
|
38
|
-
<img src="<%- value.img %>"/>
|
|
38
|
+
<img src="<%- value.img %>" alt='social' />
|
|
39
39
|
<% } else if (value.avatar) { %>
|
|
40
|
-
<img src="<%- value.avatar %>" style="border-radius:120px"/>
|
|
40
|
+
<img src="<%- value.avatar %>" alt='social' style="border-radius:120px"/>
|
|
41
41
|
<% } %>
|
|
42
42
|
</a>
|
|
43
43
|
<% } %>
|
package/package.json
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
function addImagePreviewIfNoNoindex(robotsContent) {
|
|
2
|
+
// 检查是否不包含 'noindex' 且尚未包含 max-image-preview
|
|
3
|
+
if (!robotsContent.toLowerCase().includes('noindex') &&
|
|
4
|
+
!robotsContent.toLowerCase().includes('max-image-preview')) {
|
|
5
|
+
// 处理行尾标点,确保添加格式正确
|
|
6
|
+
const trimmed = robotsContent.trim();
|
|
7
|
+
const needsSemicolon = trimmed && !trimmed.endsWith(',');
|
|
8
|
+
return `${robotsContent}${needsSemicolon ? ',' : ''} max-image-preview:large`;
|
|
9
|
+
}
|
|
10
|
+
return robotsContent;
|
|
11
|
+
}
|
|
1
12
|
hexo.extend.helper.register('generate_seo', function (theme, page) {
|
|
2
13
|
const hexo = this;
|
|
3
14
|
let robots_content = "";
|
|
@@ -19,8 +30,9 @@ hexo.extend.helper.register('generate_seo', function (theme, page) {
|
|
|
19
30
|
}
|
|
20
31
|
}
|
|
21
32
|
if (robots_content) {
|
|
33
|
+
robots_content = addImagePreviewIfNoNoindex(robots_content)
|
|
22
34
|
return `<meta name="robots" content="${robots_content}">`
|
|
23
35
|
}else{
|
|
24
|
-
return `<meta name="robots" content="index,follow">`
|
|
36
|
+
return `<meta name="robots" content="index,follow,max-image-preview:large">`
|
|
25
37
|
}
|
|
26
38
|
});
|
|
@@ -71,12 +71,14 @@ hexo.extend.helper.register("generate_title", function (config, theme, page) {
|
|
|
71
71
|
const hexo = this;
|
|
72
72
|
let data = init(hexo, config, theme, page);
|
|
73
73
|
let title = data.title
|
|
74
|
-
let s = "
|
|
74
|
+
let s = ""
|
|
75
75
|
if (title) {
|
|
76
76
|
s += `${title} - `
|
|
77
77
|
}
|
|
78
|
-
s += `${config.title}
|
|
79
|
-
|
|
78
|
+
s += `${config.title}`
|
|
79
|
+
s = hexo.strip_html(s)
|
|
80
|
+
s = hexo.escape_html(s)
|
|
81
|
+
return `<title>${s}</title>`
|
|
80
82
|
});
|
|
81
83
|
|
|
82
84
|
hexo.extend.helper.register("generate_keywords", function (config, theme, page) {
|
|
@@ -89,6 +91,8 @@ hexo.extend.helper.register("generate_keywords", function (config, theme, page)
|
|
|
89
91
|
}
|
|
90
92
|
keywords += `${config.keywords}`
|
|
91
93
|
}
|
|
94
|
+
keywords = hexo.strip_html(keywords)
|
|
95
|
+
keywords = hexo.escape_html(keywords)
|
|
92
96
|
return `<meta name="keywords" content="${keywords}">`
|
|
93
97
|
});
|
|
94
98
|
|
|
@@ -104,6 +108,8 @@ hexo.extend.helper.register("generate_description", function (config, theme, pag
|
|
|
104
108
|
}
|
|
105
109
|
}
|
|
106
110
|
description += ` - ${config.author} - ${config.title}`
|
|
111
|
+
description = hexo.strip_html(description)
|
|
112
|
+
description = hexo.escape_html(description)
|
|
107
113
|
return `<meta desc name="description" content="${description}">`
|
|
108
114
|
});
|
|
109
115
|
// open_graph() 函数会生成一个 description 标签??? https://github.com/hexojs/hexo/blob/92b979f4a3fa8714aebd3d11c3295d466b870905/lib/plugins/helper/open_graph.js#L98
|
|
@@ -111,4 +117,4 @@ hexo.extend.helper.register("generate_description", function (config, theme, pag
|
|
|
111
117
|
hexo.extend.filter.register('after_render:html', function (data) {
|
|
112
118
|
data = data.replace(/<meta name="description".*>/g, "");
|
|
113
119
|
return data;
|
|
114
|
-
}, 99);
|
|
120
|
+
}, 99);
|