Add solitude

This commit is contained in:
IF-chan
2024-07-05 21:01:19 +08:00
parent 26d71c4fbc
commit 71758b9fce
289 changed files with 23277 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
"use strict";
const { stripHTML, escapeHTML, prettyUrls } = require("hexo-util");
hexo.extend.helper.register('page_description', function () {
const { config, page } = this
let description = page.description || page.content || page.title || config.description
if (description) {
description = escapeHTML(stripHTML(description).substring(0, 150)
.trim()
).replace(/\n/g, ' ').replace(/\s+/g, ' ');
return description
}
})
hexo.extend.helper.register("urlNoIndex", function (url = null) {
return prettyUrls(url || this.url, { trailing_index: false, trailing_html: true });
});