hexo-theme-volantis 4.3.1 → 5.0.0-alpha.112
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 +6 -4
- package/_config.yml +599 -246
- package/languages/en.yml +7 -0
- package/languages/zh-CN.yml +13 -2
- package/languages/zh-TW.yml +7 -0
- package/layout/404.ejs +1 -1
- package/layout/_meta/author.ejs +4 -4
- package/layout/_meta/category.ejs +11 -8
- package/layout/_meta/counter.ejs +29 -7
- package/layout/_meta/date.ejs +1 -1
- package/layout/_meta/music.ejs +1 -1
- package/layout/_meta/share.ejs +1 -1
- package/layout/_meta/tags.ejs +3 -0
- package/layout/_meta/thumbnail.ejs +3 -1
- package/layout/_meta/updated.ejs +1 -1
- package/layout/_meta/walinecount.ejs +2 -1
- package/layout/{_cover → _partial/_cover}/blank.ejs +0 -0
- package/layout/{_cover → _partial/_cover}/dock.ejs +1 -1
- package/layout/{_cover → _partial/_cover}/featured.ejs +1 -1
- package/layout/{_cover → _partial/_cover}/focus.ejs +1 -1
- package/layout/_partial/_cover/layout.ejs +8 -0
- package/layout/{_cover → _partial/_cover}/search.ejs +2 -2
- package/layout/_partial/archive.ejs +2 -2
- package/layout/_partial/article.ejs +21 -16
- package/layout/_partial/categories.ejs +1 -1
- package/layout/_partial/cover.ejs +8 -28
- package/layout/_partial/footer.ejs +19 -11
- package/layout/_partial/head.ejs +70 -116
- package/layout/_partial/header.ejs +17 -11
- package/layout/_partial/meta.ejs +18 -4
- package/layout/_partial/post.ejs +35 -9
- package/layout/_partial/scripts/_ctrl/cdnCtrl.ejs +126 -0
- package/layout/_partial/scripts/{coverCtrl.ejs → _ctrl/coverCtrl.ejs} +17 -25
- package/layout/_partial/scripts/_ctrl.ejs +2 -0
- package/layout/_partial/scripts/content-visibility-scroll-fix.ejs +88 -0
- package/layout/_partial/scripts/global.ejs +422 -109
- package/layout/_partial/scripts/index.ejs +91 -46
- package/layout/_partial/scripts/toc.ejs +98 -68
- package/layout/_partial/side.ejs +4 -1
- package/layout/_plugins/_page_plugins/artitalk/index.ejs +15 -0
- package/layout/_plugins/_page_plugins/bbtalk/index.ejs +10 -0
- package/layout/_plugins/_page_plugins/fcircle/index.ejs +12 -0
- package/layout/_plugins/_page_plugins/gitter/index.ejs +14 -0
- package/layout/_plugins/_page_plugins/indent/index.ejs +16 -0
- package/layout/_plugins/_page_plugins/index.ejs +27 -0
- package/layout/_plugins/_page_plugins/katex/index.ejs +13 -0
- package/layout/{_third-party/math/mathjax/script.ejs → _plugins/_page_plugins/mathjax/index.ejs} +2 -2
- package/layout/_plugins/_page_plugins/snackbar/index.ejs +55 -0
- package/layout/{_partial/scripts/counter.ejs → _plugins/analytics/LCCounter.ejs} +0 -0
- package/layout/{_third-party → _plugins}/analytics/script.ejs +43 -5
- package/layout/{_third-party → _plugins}/aplayer/layout.ejs +0 -0
- package/layout/_plugins/aplayer/script.ejs +74 -0
- package/layout/_plugins/chat/gitter/script.ejs +17 -0
- package/layout/_plugins/chat/index.ejs +1 -0
- package/layout/_plugins/chat/tidio/script.ejs +1 -0
- package/layout/_plugins/comments/artalk/script.ejs +59 -0
- package/layout/_plugins/comments/beaudar/script.ejs +61 -0
- package/layout/_plugins/comments/discuss/script.ejs +30 -0
- package/layout/_plugins/comments/disqus/script.ejs +98 -0
- package/layout/_plugins/comments/disqusjs/script.ejs +35 -0
- package/layout/_plugins/comments/giscus/script.ejs +47 -0
- package/layout/_plugins/comments/gitalk/script.ejs +24 -0
- package/layout/_plugins/comments/hashover/script.ejs +5 -0
- package/layout/{_third-party → _plugins}/comments/index.ejs +10 -3
- package/layout/_plugins/comments/isso/script.ejs +27 -0
- package/layout/_plugins/comments/livere/script.ejs +15 -0
- package/layout/_plugins/comments/twikoo/script.ejs +40 -0
- package/layout/_plugins/comments/utterances/script.ejs +43 -0
- package/layout/_plugins/comments/vssue/script.ejs +37 -0
- package/layout/_plugins/comments/waline/script.ejs +62 -0
- package/layout/_plugins/comments/z-custom/script.ejs +1 -0
- package/layout/_plugins/darkmode/script.ejs +114 -0
- package/layout/{_third-party → _plugins}/end-of-support/script.ejs +25 -8
- package/layout/_plugins/github-api/script.ejs +27 -0
- package/layout/_plugins/highlight/highlightjs/script.ejs +26 -0
- package/layout/_plugins/highlight/prismjs/script.ejs +25 -0
- package/layout/_plugins/highlight/script.ejs +1 -0
- package/layout/{_third-party → _plugins}/lazyload/script.ejs +1 -1
- package/layout/{_third-party → _plugins}/nodewaves/script.ejs +1 -1
- package/layout/_plugins/parallax/script.ejs +74 -0
- package/layout/{_third-party → _plugins}/pjax/animate.ejs +31 -31
- package/layout/_plugins/pjax/index.ejs +73 -0
- package/layout/_plugins/pjax/pdata.ejs +56 -0
- package/layout/{_third-party → _plugins}/preload/script.ejs +3 -3
- package/layout/_plugins/rightmenu/layout.ejs +119 -0
- package/layout/_plugins/rightmenus/layout.ejs +137 -0
- package/layout/_plugins/scrollreveal/script.ejs +25 -0
- package/layout/_plugins/search/script.ejs +50 -0
- package/layout/{_third-party → _plugins}/share/layout.ejs +0 -0
- package/layout/_plugins/swiper/script.ejs +37 -0
- package/layout/_pre.ejs +2 -2
- package/layout/_widget/_pre.ejs +5 -0
- package/layout/_widget/blogger.ejs +1 -1
- package/layout/_widget/category.ejs +2 -2
- package/layout/_widget/copyright.ejs +1 -1
- package/layout/_widget/grid.ejs +3 -3
- package/layout/_widget/lastupdate.ejs +27 -0
- package/layout/_widget/list.ejs +2 -2
- package/layout/_widget/load.ejs +18 -0
- package/layout/_widget/music.ejs +3 -2
- package/layout/_widget/page.ejs +1 -1
- package/layout/_widget/qrcode.ejs +1 -1
- package/layout/_widget/related_posts.ejs +1 -1
- package/layout/_widget/tagcloud.ejs +1 -1
- package/layout/_widget/text.ejs +1 -1
- package/layout/_widget/toc.ejs +6 -2
- package/layout/_widget/webinfo.ejs +13 -76
- package/layout/archive.ejs +4 -4
- package/layout/category.ejs +9 -4
- package/layout/docs.ejs +1 -1
- package/layout/friends.ejs +6 -25
- package/layout/index.ejs +1 -1
- package/layout/layout.ejs +30 -12
- package/layout/list.ejs +1 -1
- package/layout/page.ejs +1 -1
- package/layout/post.ejs +1 -1
- package/layout/tag.ejs +8 -3
- package/package.json +5 -3
- package/scripts/events/index.js +13 -0
- package/scripts/events/lib/check-configuration.js +43 -0
- package/scripts/events/lib/check-environment.js +74 -0
- package/scripts/events/lib/config.js +34 -9
- package/scripts/events/lib/render-stylus.js +78 -0
- package/scripts/events/lib/stellar-tag-utils.js +76 -0
- package/scripts/filters/content-visibility.js +25 -0
- package/scripts/{render → filters}/img.js +0 -0
- package/scripts/filters/replace.js +15 -0
- package/scripts/{z-lazyload/lib/process.js → filters/z-lazyload.js} +6 -3
- package/scripts/helpers/custom-files.js +165 -0
- package/scripts/helpers/first-style.js +19 -0
- package/scripts/helpers/head/autoCanonical.js +15 -0
- package/scripts/helpers/head/generate_preload_fontfamily.js +22 -0
- package/scripts/helpers/head/generate_seo.js +24 -0
- package/scripts/helpers/head/generate_title__keywords__description.js +101 -0
- package/scripts/{related_posts/index.js → helpers/related-posts.js} +1 -1
- package/scripts/helpers/revisioned.js +158 -0
- package/scripts/helpers/structured-data/index.js +2 -0
- package/scripts/helpers/structured-data/lib/blogposting.js +77 -0
- package/scripts/helpers/structured-data/lib/breadcrumblist.js +152 -0
- package/scripts/helpers/structured-data/lib/config.js +31 -0
- package/scripts/helpers/structured-data/lib/index.js +30 -0
- package/scripts/helpers/structured-data/lib/organization.js +15 -0
- package/scripts/helpers/structured-data/lib/person.js +16 -0
- package/scripts/helpers/structured-data/lib/website.js +42 -0
- package/scripts/tags/btn.js +6 -1
- package/scripts/tags/btns.js +7 -2
- package/scripts/tags/checkbox.js +12 -2
- package/scripts/tags/contributors.js +100 -0
- package/scripts/tags/dropmenu.js +18 -3
- package/scripts/tags/fancybox.js +44 -10
- package/scripts/tags/folding.js +6 -1
- package/scripts/tags/frame.js +6 -1
- package/scripts/tags/friends.js +99 -0
- package/scripts/tags/ghcard.js +6 -1
- package/scripts/tags/image.js +14 -2
- package/scripts/tags/link.js +6 -1
- package/scripts/tags/md.js +59 -0
- package/scripts/tags/media.js +25 -1
- package/scripts/tags/note.js +36 -3
- package/scripts/tags/site.js +87 -51
- package/scripts/tags/span.js +12 -2
- package/scripts/tags/swiper.js +38 -0
- package/scripts/tags/tabs.js +33 -3
- package/scripts/tags/timeline.js +6 -1
- package/source/css/Readme.md +28 -0
- package/source/css/_defines/AutoPrefixCSS.styl +347 -0
- package/source/css/_defines/Readme.md +3 -0
- package/source/css/_defines/color.styl +41 -1
- package/source/css/_defines/effect.styl +0 -13
- package/source/css/_defines/fonts.styl +17 -18
- package/source/css/_defines/func.styl +12 -30
- package/source/css/_first/base_first.styl +118 -0
- package/source/css/_first/{cover.styl → cover_first.styl} +113 -87
- package/source/css/_first/dark_first.styl +76 -0
- package/source/css/_first/fontfamily_first.styl +17 -0
- package/source/css/_first/{navbar.styl → navbar_first.styl} +4 -10
- package/source/css/_first/search_first.styl +12 -0
- package/source/css/{_base/index.styl → _style/_base/base.styl} +9 -93
- package/source/css/_style/_base/fontfamily_async.styl +8 -0
- package/source/css/{_layout → _style/_layout}/archive.styl +0 -0
- package/source/css/{_layout → _style/_layout}/article.styl +3 -30
- package/source/css/{_layout → _style/_layout}/footer.styl +0 -0
- package/source/css/_style/_layout/friends-simpleuser.styl +23 -0
- package/source/css/_style/_layout/friends-traditional.styl +81 -0
- package/source/css/{_layout → _style/_layout}/img.styl +0 -0
- package/source/css/_style/_layout/loading.styl +14 -0
- package/source/css/{_layout → _style/_layout}/main.styl +19 -7
- package/source/css/{_layout → _style/_layout}/md.styl +0 -0
- package/source/css/{_layout → _style/_layout}/pagination.styl +1 -1
- package/source/css/{_layout → _style/_layout}/posts.styl +2 -0
- package/source/css/{_first → _style/_layout}/search.styl +0 -103
- package/source/css/{_layout → _style/_layout}/sidebar.styl +23 -3
- package/source/css/{_layout → _style/_layout}/snackbar.styl +0 -0
- package/source/css/{_layout → _style/_layout}/toc.styl +3 -3
- package/source/css/{_layout → _style/_layout}/video.styl +0 -0
- package/source/css/_style/_plugins/_dark/dark_async.styl +41 -0
- package/source/css/_style/_plugins/_dark/dark_plugins.styl +136 -0
- package/source/css/_style/_plugins/_highlight/highlightjs/clipboard.styl +36 -0
- package/source/css/_style/_plugins/_highlight/highlightjs/color.styl +96 -0
- package/source/css/_style/_plugins/_highlight/highlightjs/index.styl +102 -0
- package/source/css/_style/_plugins/_highlight/highlightjs/language.styl +63 -0
- package/source/css/_style/_plugins/_highlight/index.styl +1 -0
- package/source/css/_style/_plugins/_highlight/prismjs/clipboard.styl +33 -0
- package/source/css/_style/_plugins/_highlight/prismjs/index.styl +8 -0
- package/source/css/_style/_plugins/_highlight/prismjs/language.styl +63 -0
- package/source/css/_style/_plugins/_rightmenu/reading.styl +56 -0
- package/source/css/{_plugins → _style/_plugins/_rightmenu}/rightmenu.styl +22 -2
- package/source/css/{_plugins → _style/_plugins}/aplayer.styl +8 -1
- package/source/css/{_plugins → _style/_plugins}/cursor.styl +49 -19
- package/source/css/_style/_plugins/fontcolor.styl +84 -0
- package/source/css/{_plugins → _style/_plugins}/gitalk.styl +0 -0
- package/source/css/_style/_plugins/index.styl +24 -0
- package/source/css/{_plugins → _style/_plugins}/mathjax.styl +0 -0
- package/source/css/_style/_plugins/message.styl +14 -0
- package/source/css/{_plugins → _style/_plugins}/pjaxanimate.styl +0 -0
- package/source/css/_style/_tag-plugins/Readme.md +6 -0
- package/source/css/{_tag-plugins → _style/_tag-plugins}/btns.styl +0 -0
- package/source/css/{_tag-plugins → _style/_tag-plugins}/checkbox.styl +0 -0
- package/source/css/{_tag-plugins → _style/_tag-plugins}/dropmenu.styl +0 -0
- package/source/css/{_plugins → _style/_tag-plugins}/fancybox.styl +8 -9
- package/source/css/{_tag-plugins → _style/_tag-plugins}/folding.styl +0 -0
- package/source/css/{_tag-plugins → _style/_tag-plugins}/frame.styl +0 -0
- package/source/css/_style/_tag-plugins/friends.styl +72 -0
- package/source/css/{_tag-plugins → _style/_tag-plugins}/ghcard.styl +0 -0
- package/source/css/{_tag-plugins → _style/_tag-plugins}/image.styl +0 -0
- package/source/css/{_tag-plugins → _style/_tag-plugins}/link.styl +0 -0
- package/source/css/{_tag-plugins → _style/_tag-plugins}/media.styl +0 -0
- package/source/css/{_tag-plugins → _style/_tag-plugins}/note.styl +0 -0
- package/source/css/_style/_tag-plugins/sites.styl +87 -0
- package/source/css/{_tag-plugins → _style/_tag-plugins}/span.styl +0 -0
- package/source/css/_style/_tag-plugins/swiper.styl +44 -0
- package/source/css/{_tag-plugins → _style/_tag-plugins}/table.styl +0 -0
- package/source/css/{_tag-plugins → _style/_tag-plugins}/tabs.styl +0 -0
- package/source/css/_style/_tag-plugins/tag.json +35 -0
- package/source/css/_style/_tag-plugins/text.styl +31 -0
- package/source/css/{_tag-plugins → _style/_tag-plugins}/timeline.styl +0 -0
- package/source/css/_style/index.styl +8 -0
- package/source/css/first.styl +17 -6
- package/source/css/style.styl +9 -7
- package/source/js/app.js +1051 -278
- package/source/js/plugins/aplayer.js +186 -0
- package/source/js/plugins/parallax.js +191 -0
- package/source/js/plugins/rightMenu.js +577 -0
- package/source/js/plugins/rightMenus.js +616 -0
- package/source/js/plugins/tags/contributors.js +92 -0
- package/source/js/plugins/tags/friends.js +93 -0
- package/source/js/plugins/tags/sites.js +96 -0
- package/source/js/search/hexo.js +180 -373
- package/.eslintrc.json +0 -111
- package/layout/_meta/valinecount.ejs +0 -15
- package/layout/_partial/rightmenu.ejs +0 -199
- package/layout/_partial/scripts/cover.ejs +0 -45
- package/layout/_partial/scripts/darkmode.ejs +0 -85
- package/layout/_partial/scripts/import.ejs +0 -3
- package/layout/_partial/scripts/issues.ejs +0 -18
- package/layout/_partial/scripts/search.ejs +0 -62
- package/layout/_partial/snackbar.ejs +0 -22
- package/layout/_third-party/aplayer/script.ejs +0 -26
- package/layout/_third-party/clipboard/script.ejs +0 -54
- package/layout/_third-party/comments/disqus/layout.ejs +0 -5
- package/layout/_third-party/comments/disqus/script.ejs +0 -90
- package/layout/_third-party/comments/disqusjs/layout.ejs +0 -1
- package/layout/_third-party/comments/disqusjs/script.ejs +0 -34
- package/layout/_third-party/comments/gitalk/layout.ejs +0 -1
- package/layout/_third-party/comments/gitalk/script.ejs +0 -22
- package/layout/_third-party/comments/hashover/layout.ejs +0 -2
- package/layout/_third-party/comments/hashover/script.ejs +0 -1
- package/layout/_third-party/comments/isso/layout.ejs +0 -1
- package/layout/_third-party/comments/isso/script.ejs +0 -1
- package/layout/_third-party/comments/livere/layout.ejs +0 -3
- package/layout/_third-party/comments/livere/script.ejs +0 -10
- package/layout/_third-party/comments/minivaline/layout.ejs +0 -3
- package/layout/_third-party/comments/minivaline/script.ejs +0 -34
- package/layout/_third-party/comments/twikoo/layout.ejs +0 -3
- package/layout/_third-party/comments/twikoo/script.ejs +0 -32
- package/layout/_third-party/comments/valine/layout.ejs +0 -3
- package/layout/_third-party/comments/valine/script.ejs +0 -49
- package/layout/_third-party/comments/vssue/layout.ejs +0 -1
- package/layout/_third-party/comments/vssue/script.ejs +0 -21
- package/layout/_third-party/comments/waline/layout.ejs +0 -3
- package/layout/_third-party/comments/waline/script.ejs +0 -33
- package/layout/_third-party/fancybox/script.ejs +0 -61
- package/layout/_third-party/highlightjs/script.ejs +0 -11
- package/layout/_third-party/pjax/index.ejs +0 -78
- package/layout/_third-party/pjax/pdata.ejs +0 -53
- package/layout/_third-party/scrollreveal/script.ejs +0 -21
- package/layout/_third-party/tidio/script.ejs +0 -3
- package/layout/artitalk.ejs +0 -13
- package/layout/bb.ejs +0 -10
- package/package-lock.json +0 -916
- package/scripts/tags/issues.js +0 -41
- package/scripts/z-lazyload/index.js +0 -4
- package/source/css/_highlight/index.styl +0 -316
- package/source/css/_layout/friends.styl +0 -79
- package/source/css/_plugins/clipboard.styl +0 -37
- package/source/css/_plugins/dark.styl +0 -149
- package/source/css/_plugins/darkmode.styl +0 -9
- package/source/css/_plugins/index.styl +0 -18
- package/source/css/_plugins/twikoo.styl +0 -21
- package/source/css/_plugins/valine.styl +0 -183
- package/source/css/_tag-plugins/simpleuser.styl +0 -21
- package/source/css/_tag-plugins/site-card.styl +0 -70
- package/source/js/aplayer.js +0 -167
- package/source/js/issues.js +0 -186
- package/source/js/search/algolia.js +0 -344
- package/source/js/search/azure.js +0 -355
- package/source/js/search/baidu.js +0 -340
- package/source/js/search/google.js +0 -339
- package/source/js/valine.js +0 -5137
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// hexo.renderStylus 渲染 Stylus 的工具函数
|
|
2
|
+
// hexo.createUuid 创建 uuid
|
|
3
|
+
|
|
4
|
+
const stylus = require("stylus");
|
|
5
|
+
const Promise = require("bluebird");
|
|
6
|
+
|
|
7
|
+
module.exports = hexo => {
|
|
8
|
+
hexo.renderStylus = async (str) => {
|
|
9
|
+
/**************************************************************************** */
|
|
10
|
+
// from https://github.com/hexojs/hexo-renderer-stylus/blob/8f63a5e1ad886466ce59532978dfa34b4b3c6dc7/lib/renderer.js#L5
|
|
11
|
+
function getProperty(obj, name) {
|
|
12
|
+
name = name.replace(/\[(\w+)\]/g, ".$1").replace(/^\./, "");
|
|
13
|
+
const split = name.split(".");
|
|
14
|
+
let key = split.shift();
|
|
15
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) return "";
|
|
16
|
+
let result = obj[key];
|
|
17
|
+
const len = split.length;
|
|
18
|
+
if (!len) return result || "";
|
|
19
|
+
if (typeof result !== "object") return "";
|
|
20
|
+
for (let i = 0; i < len; i++) {
|
|
21
|
+
key = split[i];
|
|
22
|
+
if (!Object.prototype.hasOwnProperty.call(result, key)) return "";
|
|
23
|
+
result = result[split[i]];
|
|
24
|
+
if (typeof result !== "object") return result;
|
|
25
|
+
}
|
|
26
|
+
return result;
|
|
27
|
+
}
|
|
28
|
+
function defineConfig(style) {
|
|
29
|
+
style.define("hexo-config", (data) => {
|
|
30
|
+
return getProperty(hexo.theme.config, data.val);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/**************************************************************************** */
|
|
34
|
+
return new Promise((resolve) => {
|
|
35
|
+
return stylus(str)
|
|
36
|
+
.use(defineConfig)
|
|
37
|
+
.include(hexo.theme.context.theme_dir + "source/css/")
|
|
38
|
+
.render(function (err, css) {
|
|
39
|
+
if (err) throw err;
|
|
40
|
+
resolve(css);
|
|
41
|
+
return css;
|
|
42
|
+
});
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
hexo.createUuid = () => {
|
|
46
|
+
let s = [];
|
|
47
|
+
const hexDigits = '0123456789abcdef';
|
|
48
|
+
for (let i = 0; i < 36; i++) {
|
|
49
|
+
s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
|
|
50
|
+
}
|
|
51
|
+
s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1);
|
|
52
|
+
s[8] = s[13] = s[18] = s[23] = '-';
|
|
53
|
+
return s.join('');
|
|
54
|
+
};
|
|
55
|
+
hexo.merge = merge;
|
|
56
|
+
hexo.getType = getType;
|
|
57
|
+
};
|
|
58
|
+
function isObject(item) {
|
|
59
|
+
return item && typeof item === 'object' && !Array.isArray(item);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function merge(target, source) {
|
|
63
|
+
for (const key in source) {
|
|
64
|
+
if (isObject(target[key]) && isObject(source[key])) {
|
|
65
|
+
merge(target[key], source[key]);
|
|
66
|
+
} else {
|
|
67
|
+
target[key] = source[key];
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return target;
|
|
71
|
+
}
|
|
72
|
+
function getType(file){
|
|
73
|
+
var filename=file;
|
|
74
|
+
var index1=filename.lastIndexOf(".");
|
|
75
|
+
var index2=filename.length;
|
|
76
|
+
var type=filename.substring(index1+1,index2);
|
|
77
|
+
return type;
|
|
78
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* utils.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
// stellar 标签插件 命令解析器
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
module.exports = hexo => {
|
|
11
|
+
hexo.args = {
|
|
12
|
+
map: (args, keys, others) => {
|
|
13
|
+
if (Array.isArray(args) == false) {
|
|
14
|
+
return args;
|
|
15
|
+
}
|
|
16
|
+
var map = {others: Array()};
|
|
17
|
+
args.forEach((arg, i) => {
|
|
18
|
+
let kv = arg.trim();
|
|
19
|
+
if (kv.includes('://') && kv.split(':').length == 2) {
|
|
20
|
+
// 纯 url
|
|
21
|
+
map.others.push(kv);
|
|
22
|
+
} else {
|
|
23
|
+
kv = kv.split(':');
|
|
24
|
+
if (kv.length > 1) {
|
|
25
|
+
if (keys.includes(kv[0]) == true) {
|
|
26
|
+
map[kv.shift()] = kv.join(':');
|
|
27
|
+
} else {
|
|
28
|
+
map.others.push(kv.join(':'));
|
|
29
|
+
}
|
|
30
|
+
} else if (kv.length == 1) {
|
|
31
|
+
map.others.push(kv[0]);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
// 解析不带 key 的参数
|
|
36
|
+
if (others && others.length > 0 && map.others.length > 0) {
|
|
37
|
+
if (Array.isArray(others) == false) {
|
|
38
|
+
others = [others];
|
|
39
|
+
}
|
|
40
|
+
others.forEach((arg, i) => {
|
|
41
|
+
map[arg] = map.others.shift();
|
|
42
|
+
});
|
|
43
|
+
// 最后一段合并到最后一个参数中
|
|
44
|
+
if (map.others.length > 0) {
|
|
45
|
+
map[others[others.length-1]] += ' ' + map.others.join(' ');
|
|
46
|
+
map.others = [];
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return map;
|
|
50
|
+
},
|
|
51
|
+
joinTags: (args, keys) => {
|
|
52
|
+
if (Array.isArray(keys) == false) {
|
|
53
|
+
keys = [keys];
|
|
54
|
+
}
|
|
55
|
+
var ret = [];
|
|
56
|
+
keys.forEach((key, i) => {
|
|
57
|
+
if (args[key] && args[key].length > 0) {
|
|
58
|
+
ret.push(key + '="' + args[key] + '"');
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
return ret;
|
|
62
|
+
},
|
|
63
|
+
joinURLParams: (args, keys) => {
|
|
64
|
+
if (Array.isArray(keys) == false) {
|
|
65
|
+
keys = [keys];
|
|
66
|
+
}
|
|
67
|
+
var ret = [];
|
|
68
|
+
keys.forEach((key, i) => {
|
|
69
|
+
if (args[key] && args[key].length > 0) {
|
|
70
|
+
ret.push(key + '=' + args[key]);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
return ret.join('&');
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// https://web.dev/content-visibility/
|
|
2
|
+
// https://www.caniuse.com/?search=content-visibility
|
|
3
|
+
// 在文章内容渲染时将每两个 <h2> 之间的内容分为一块 用 <div class="post-story"></div> 包裹起来。然后为 .post-story 声明 content-visibility: auto
|
|
4
|
+
hexo.extend.filter.register('after_post_render', function (data) {
|
|
5
|
+
let dataList = data.content.split('\n')
|
|
6
|
+
let mydata = ``
|
|
7
|
+
let flag = 1
|
|
8
|
+
dataList.forEach(e => {
|
|
9
|
+
let yy = e.replace(/<h2.*?>.*?<\/h2>/, function (str) {
|
|
10
|
+
if (flag) {
|
|
11
|
+
flag = 0
|
|
12
|
+
return `<div class="story post-story">` + str
|
|
13
|
+
} else {
|
|
14
|
+
return `</div><div class="story post-story">` + str
|
|
15
|
+
}
|
|
16
|
+
})
|
|
17
|
+
mydata += yy
|
|
18
|
+
mydata += "\n"
|
|
19
|
+
});
|
|
20
|
+
if (!flag) {
|
|
21
|
+
mydata += `</div>`
|
|
22
|
+
}
|
|
23
|
+
data.content = mydata
|
|
24
|
+
return data;
|
|
25
|
+
});
|
|
File without changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/* global hexo */
|
|
2
|
+
|
|
3
|
+
'use strict';
|
|
4
|
+
|
|
5
|
+
hexo.extend.filter.register('after_render:html', function(data) {
|
|
6
|
+
if (hexo.theme.config.replace) {
|
|
7
|
+
hexo.theme.config.replace.forEach(e => {
|
|
8
|
+
let s = e.split(" => ")
|
|
9
|
+
let a = s[0]
|
|
10
|
+
let b = s[1]
|
|
11
|
+
data = data.replace(new RegExp(a,"g"), b);
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
return data;
|
|
15
|
+
},999999999999);
|
|
@@ -52,16 +52,19 @@ function lazyProcess(htmlContent, target) {
|
|
|
52
52
|
if (loadingImg) {
|
|
53
53
|
return result.replace(p2, p2 + '" class="lazyload placeholder" ' + 'data-srcset="' + p2 + '" srcset="' + loadingImg);
|
|
54
54
|
}
|
|
55
|
-
return result.replace(p2, p2 + '" class="lazyload" ' + 'data-srcset="' + p2 + '" srcset="' + 'data:image/
|
|
55
|
+
return result.replace(p2, p2 + '" class="lazyload" ' + 'data-srcset="' + p2 + '" srcset="' + 'data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==');
|
|
56
56
|
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
let processPost = function(data) {
|
|
61
61
|
data.content = lazyProcess.call(this, data.content, 'post');
|
|
62
62
|
return data;
|
|
63
63
|
};
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
let processSite = function(htmlContent) {
|
|
66
66
|
return lazyProcess.call(this, htmlContent, 'site');
|
|
67
67
|
};
|
|
68
|
+
|
|
69
|
+
hexo.extend.filter.register('after_post_render', processPost);
|
|
70
|
+
hexo.extend.filter.register('after_render:html', processSite);
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
// Custom Files 自定义文件 --- Modified From NexT ---
|
|
2
|
+
|
|
3
|
+
const fs = require('hexo-fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const defaultExtname = '.ejs';
|
|
6
|
+
let points = {
|
|
7
|
+
styles: [
|
|
8
|
+
"first",
|
|
9
|
+
"style",
|
|
10
|
+
"dark",
|
|
11
|
+
"darkVar",
|
|
12
|
+
],
|
|
13
|
+
views: [
|
|
14
|
+
"headBegin",
|
|
15
|
+
"headEnd",
|
|
16
|
+
"header",
|
|
17
|
+
"side",
|
|
18
|
+
"topMeta",
|
|
19
|
+
"bottomMeta",
|
|
20
|
+
"footer",
|
|
21
|
+
"postEnd",
|
|
22
|
+
"bodyBegin",
|
|
23
|
+
"bodyEnd",
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
// hexo s 和 hexo server 时监听自定义文件变动
|
|
27
|
+
function watchFile(path) {
|
|
28
|
+
let arg = process.argv[2];
|
|
29
|
+
if (arg == "s" || arg == "server") {
|
|
30
|
+
fs.watch(path)
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function isObject(item) {
|
|
34
|
+
return item && typeof item === 'object' && !Array.isArray(item);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function merge(target, source) {
|
|
38
|
+
for (const key in source) {
|
|
39
|
+
if (isObject(target[key]) && isObject(source[key])) {
|
|
40
|
+
merge(target[key], source[key]);
|
|
41
|
+
} else {
|
|
42
|
+
target[key] = source[key];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return target;
|
|
46
|
+
}
|
|
47
|
+
hexo.merge = merge;
|
|
48
|
+
hexo.extend.filter.register('theme_inject', injects => {
|
|
49
|
+
|
|
50
|
+
let filePath = {}
|
|
51
|
+
points.styles.forEach(key => {
|
|
52
|
+
filePath[key] = "source/_volantis/" + key + ".styl"
|
|
53
|
+
});
|
|
54
|
+
points.views.forEach(key => {
|
|
55
|
+
filePath[key] = "source/_volantis/" + key + defaultExtname
|
|
56
|
+
});
|
|
57
|
+
filePath = hexo.merge(filePath, hexo.theme.config.custom_files)
|
|
58
|
+
// console.log(filePath);
|
|
59
|
+
// console.log(hexo.theme.config.custom_files);
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
points.styles.forEach(key => {
|
|
63
|
+
if (filePath[key]) {
|
|
64
|
+
injects[key].push(filePath[key]);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
points.views.forEach(key => {
|
|
68
|
+
if (filePath[key]) {
|
|
69
|
+
injects[key].file('custom', filePath[key]);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}, 99);
|
|
73
|
+
hexo.extend.helper.register('volantis_inject', function (point) {
|
|
74
|
+
if (this.theme.injects[point]) {
|
|
75
|
+
return this.theme.injects[point]
|
|
76
|
+
.map(item => this.partial(item.layout, item.locals, item.options))
|
|
77
|
+
.join('');
|
|
78
|
+
}
|
|
79
|
+
return []
|
|
80
|
+
});
|
|
81
|
+
hexo.on('generateBefore', function () {
|
|
82
|
+
hexo.theme.config.custom = {};
|
|
83
|
+
// Defining stylus types
|
|
84
|
+
class StylusInject {
|
|
85
|
+
constructor(base_dir) {
|
|
86
|
+
this.base_dir = base_dir;
|
|
87
|
+
this.files = [];
|
|
88
|
+
}
|
|
89
|
+
push(file) {
|
|
90
|
+
// Get absolute path base on hexo dir
|
|
91
|
+
let temp_path = path.resolve(this.base_dir, file)
|
|
92
|
+
watchFile(temp_path)
|
|
93
|
+
if (fs.existsSync(temp_path)) {
|
|
94
|
+
this.files.push(temp_path);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
// Defining view types
|
|
99
|
+
class ViewInject {
|
|
100
|
+
constructor(base_dir) {
|
|
101
|
+
this.base_dir = base_dir;
|
|
102
|
+
this.raws = [];
|
|
103
|
+
}
|
|
104
|
+
raw(name, raw, ...args) {
|
|
105
|
+
// Set default extname
|
|
106
|
+
if (path.extname(name) === '') {
|
|
107
|
+
name += defaultExtname;
|
|
108
|
+
}
|
|
109
|
+
this.raws.push({ name, raw, args });
|
|
110
|
+
}
|
|
111
|
+
file(name, file, ...args) {
|
|
112
|
+
// Set default extname from file's extname
|
|
113
|
+
if (path.extname(name) === '') {
|
|
114
|
+
name += path.extname(file);
|
|
115
|
+
}
|
|
116
|
+
// Get absolute path base on hexo dir
|
|
117
|
+
let temp_path = path.resolve(this.base_dir, file)
|
|
118
|
+
let temp_raw = ""
|
|
119
|
+
watchFile(temp_path)
|
|
120
|
+
if (fs.existsSync(temp_path)) {
|
|
121
|
+
temp_raw = fs.readFileSync(temp_path)
|
|
122
|
+
}
|
|
123
|
+
this.raw(name, temp_raw, ...args);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
// Init injects
|
|
127
|
+
function initInject(base_dir) {
|
|
128
|
+
const injects = {};
|
|
129
|
+
points.styles.forEach(item => {
|
|
130
|
+
injects[item] = new StylusInject(base_dir);
|
|
131
|
+
});
|
|
132
|
+
points.views.forEach(item => {
|
|
133
|
+
injects[item] = new ViewInject(base_dir);
|
|
134
|
+
});
|
|
135
|
+
return injects;
|
|
136
|
+
}
|
|
137
|
+
hexo.theme.config.injects = {};
|
|
138
|
+
const injects = initInject(hexo.base_dir);
|
|
139
|
+
hexo.execFilterSync('theme_inject', injects);
|
|
140
|
+
points.styles.forEach(type => {
|
|
141
|
+
hexo.theme.config.injects[type] = injects[type].files;
|
|
142
|
+
});
|
|
143
|
+
// Inject views
|
|
144
|
+
points.views.forEach(type => {
|
|
145
|
+
const configs = Object.create(null);
|
|
146
|
+
hexo.theme.config.injects[type] = [];
|
|
147
|
+
// Add or override view.
|
|
148
|
+
injects[type].raws.forEach((injectObj, index) => {
|
|
149
|
+
const name = `inject/${type}/${injectObj.name}`;
|
|
150
|
+
hexo.theme.setView(name, injectObj.raw);
|
|
151
|
+
configs[name] = {
|
|
152
|
+
layout: name,
|
|
153
|
+
locals: injectObj.args[0],
|
|
154
|
+
options: injectObj.args[1],
|
|
155
|
+
order: injectObj.args[2] || index
|
|
156
|
+
};
|
|
157
|
+
});
|
|
158
|
+
// Views sort.
|
|
159
|
+
hexo.theme.config.injects[type] = Object.values(configs).sort((x, y) => x.order - y.order)
|
|
160
|
+
// console.log(injects);
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// 将首屏样式 first.styl 硬编码到HTML页面
|
|
2
|
+
"use strict";
|
|
3
|
+
const fs = require("hexo-fs");
|
|
4
|
+
|
|
5
|
+
function generateFirstCSS() {
|
|
6
|
+
let s = fs.readFileSync(
|
|
7
|
+
hexo.theme.context.theme_dir + "source/css/first.styl"
|
|
8
|
+
);
|
|
9
|
+
hexo.renderStylus(s).then((css)=>{
|
|
10
|
+
hexo.locals.set('FirstCSS', function(){
|
|
11
|
+
return css
|
|
12
|
+
});
|
|
13
|
+
})
|
|
14
|
+
}
|
|
15
|
+
function getFirstCSS() {
|
|
16
|
+
return hexo.locals.get('FirstCSS');
|
|
17
|
+
}
|
|
18
|
+
hexo.extend.filter.register("before_generate", generateFirstCSS);
|
|
19
|
+
hexo.extend.helper.register("FirstCSS", getFirstCSS);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* hexo-auto-canonical
|
|
3
|
+
* https://github.com/hyunseob/hexo-auto-canonical.git
|
|
4
|
+
* Copyright (c) 2015, HyunSeob
|
|
5
|
+
* Licensed under the MIT license.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
hexo.extend.helper.register('autoCanonical', function (config, page) {
|
|
11
|
+
var base_url = config.url;
|
|
12
|
+
if (config.url.charAt(config.url.length - 1) !== '/') base_url += '/';
|
|
13
|
+
|
|
14
|
+
return '<link rel="canonical" href="' + base_url + page.canonical_path.replace('index.html', '').toLowerCase() + '"/>';
|
|
15
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
function getType(file) {
|
|
2
|
+
var filename = file;
|
|
3
|
+
var index1 = filename.lastIndexOf(".");
|
|
4
|
+
var index2 = filename.length;
|
|
5
|
+
var type = filename.substring(index1 + 1, index2);
|
|
6
|
+
return type;
|
|
7
|
+
}
|
|
8
|
+
function getLink_preload(Url) {
|
|
9
|
+
return `<link rel="preload" href="${Url}" as="font" type="font/${getType(Url)}" crossorigin="anonymous">\n`
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
hexo.extend.helper.register("generate_preload_fontfamily", function (theme) {
|
|
13
|
+
const hexo = this;
|
|
14
|
+
let preload = "";
|
|
15
|
+
if (theme.custom_css.fontfamily.logofont && theme.custom_css.fontfamily.logofont.url) {
|
|
16
|
+
preload += getLink_preload(theme.custom_css.fontfamily.logofont.url)
|
|
17
|
+
}
|
|
18
|
+
if (theme.custom_css.fontfamily.bodyfont && theme.custom_css.fontfamily.bodyfont.url) {
|
|
19
|
+
preload += getLink_preload(theme.custom_css.fontfamily.bodyfont.url)
|
|
20
|
+
}
|
|
21
|
+
return preload
|
|
22
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
hexo.extend.helper.register('generate_seo', function (theme, page) {
|
|
2
|
+
const hexo = this;
|
|
3
|
+
let robots_content="";
|
|
4
|
+
if (page.robots) {
|
|
5
|
+
robots_content = page.robots
|
|
6
|
+
} else if (theme.seo && theme.seo.robots) {
|
|
7
|
+
if (hexo.is_home()) {
|
|
8
|
+
if (page.prev == 0) {
|
|
9
|
+
robots_content=theme.seo.robots.home_first_page
|
|
10
|
+
}else{
|
|
11
|
+
robots_content=theme.seo.robots.home_other_pages
|
|
12
|
+
}
|
|
13
|
+
} else if (hexo.is_archive()) {
|
|
14
|
+
robots_content=theme.seo.robots.archive
|
|
15
|
+
} else if (hexo.is_category()) {
|
|
16
|
+
robots_content=theme.seo.robots.category
|
|
17
|
+
} else if (hexo.is_tag()) {
|
|
18
|
+
robots_content=theme.seo.robots.tag
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
if(robots_content){
|
|
22
|
+
return `<meta name="robots" content="${robots_content}">`
|
|
23
|
+
}
|
|
24
|
+
});
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
function init(hexo, config, theme, page) {
|
|
2
|
+
var title = page.seo_title || page.title;
|
|
3
|
+
var keywords = page.keywords || "";
|
|
4
|
+
var description = page.description || "";
|
|
5
|
+
if (hexo.is_archive()) {
|
|
6
|
+
title = hexo.__("navbar.archive");
|
|
7
|
+
if (hexo.is_month()) {
|
|
8
|
+
title += hexo.__("symbol.colon") + page.year + "/" + page.month;
|
|
9
|
+
} else if (hexo.is_year()) {
|
|
10
|
+
title += hexo.__("symbol.colon") + page.year;
|
|
11
|
+
}
|
|
12
|
+
} else if (hexo.is_category()) {
|
|
13
|
+
title = hexo.__("navbar.category") + hexo.__("symbol.colon") + page.category;
|
|
14
|
+
} else if (hexo.is_tag()) {
|
|
15
|
+
title = hexo.__("navbar.tag") + hexo.__("symbol.colon") + page.tag;
|
|
16
|
+
} else if (hexo.is_home() && page.prev == 0) {
|
|
17
|
+
keywords = config.keywords || "";
|
|
18
|
+
description = config.description || "";
|
|
19
|
+
} else {
|
|
20
|
+
if (
|
|
21
|
+
page.layout == "docs" &&
|
|
22
|
+
page.group &&
|
|
23
|
+
page.group in theme.sidebar.widget_library
|
|
24
|
+
) {
|
|
25
|
+
let widget = theme.sidebar.widget_library[page.group];
|
|
26
|
+
if (widget.class == "group" && widget.seo_title) {
|
|
27
|
+
title = widget.seo_title + ": " + title;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (theme.seo && theme.seo.use_tags_as_keywords) {
|
|
32
|
+
if (!keywords && page.tags && page.tags.length > 0) {
|
|
33
|
+
let tags = page.tags
|
|
34
|
+
.map(function (t) {
|
|
35
|
+
return t.name;
|
|
36
|
+
})
|
|
37
|
+
.join(",");
|
|
38
|
+
if (tags.length > 0) {
|
|
39
|
+
keywords += tags;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (theme.seo && theme.seo.use_excerpt_as_description) {
|
|
44
|
+
if (page.description == undefined) {
|
|
45
|
+
if (page.excerpt) {
|
|
46
|
+
description = hexo.truncate(hexo.strip_html(page.excerpt), { length: 160 });
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
title: title,
|
|
52
|
+
keywords: keywords,
|
|
53
|
+
description: description,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
hexo.extend.helper.register("generate_title", function (config, theme, page) {
|
|
58
|
+
const hexo = this;
|
|
59
|
+
let data = init(hexo, config, theme, page);
|
|
60
|
+
let title = data.title
|
|
61
|
+
let s = "<title>"
|
|
62
|
+
if (title) {
|
|
63
|
+
s += `${title} - `
|
|
64
|
+
}
|
|
65
|
+
s += `${config.title}</title>`
|
|
66
|
+
return s
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
hexo.extend.helper.register("generate_keywords", function (config, theme, page) {
|
|
70
|
+
const hexo = this;
|
|
71
|
+
let data = init(hexo, config, theme, page);
|
|
72
|
+
let keywords = data.keywords
|
|
73
|
+
if (!(hexo.is_home() && page.prev == 0)) {
|
|
74
|
+
if (keywords) {
|
|
75
|
+
keywords += `,`
|
|
76
|
+
}
|
|
77
|
+
keywords += `${config.keywords}`
|
|
78
|
+
}
|
|
79
|
+
return `<meta name="keywords" content="${keywords}">`
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
hexo.extend.helper.register("generate_description", function (config, theme, page) {
|
|
83
|
+
const hexo = this;
|
|
84
|
+
let data = init(hexo, config, theme, page);
|
|
85
|
+
let description = data.description
|
|
86
|
+
if (!description) {
|
|
87
|
+
if (config.description) {
|
|
88
|
+
description = config.description
|
|
89
|
+
}else{
|
|
90
|
+
description = config.title
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
description += ` - ${config.author} - ${config.title}`
|
|
94
|
+
return `<meta desc name="description" content="${description}">`
|
|
95
|
+
});
|
|
96
|
+
// open_graph() 函数会生成一个 description 标签??? https://github.com/hexojs/hexo/blob/92b979f4a3fa8714aebd3d11c3295d466b870905/lib/plugins/helper/open_graph.js#L98
|
|
97
|
+
// 移除 open_graph() 函数会生成的 description
|
|
98
|
+
hexo.extend.filter.register('after_render:html', function(data) {
|
|
99
|
+
data = data.replace(/<meta name="description".*>/g, "");
|
|
100
|
+
return data;
|
|
101
|
+
},99);
|
|
@@ -24,7 +24,7 @@ hexo.extend.helper.register('htmlGenerator', function(args) {
|
|
|
24
24
|
var ret = '';
|
|
25
25
|
ret += '<a class="item" href="' + list.path + '" title="' + list.title + '" rel="bookmark ">';
|
|
26
26
|
|
|
27
|
-
if (cfg.placeholder_img.length > 0) {
|
|
27
|
+
if (cfg.placeholder_img && cfg.placeholder_img.length > 0) {
|
|
28
28
|
if (list.img && list.img != '') {
|
|
29
29
|
ret += '<img src="' + list.img + '" />';
|
|
30
30
|
} else {
|