mirror of
https://github.com/KivotosRailway/website.git
synced 2026-11-03 19:07:56 +09:00
Add solitude
This commit is contained in:
@@ -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 });
|
||||
});
|
||||
Reference in New Issue
Block a user