summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/feed.js7
-rw-r--r--scripts/meta.js9
2 files changed, 11 insertions, 5 deletions
diff --git a/scripts/feed.js b/scripts/feed.js
index 6ea931e..a28cea2 100644
--- a/scripts/feed.js
+++ b/scripts/feed.js
@@ -1,7 +1,5 @@
'use strict';
-const podcast = require("podcast");
-
hexo.extend.generator.register("feed", (locals) => {
// Load config
@@ -11,6 +9,8 @@ hexo.extend.generator.register("feed", (locals) => {
const hstrip = hexo.extend.helper.get("strip_html").bind(hexo);
if (!theme.rss || !theme.rss.enable) return;
+ const podcast = require("podcast");
+
// Render for site config
const feed = new podcast({
title: config.title,
@@ -33,9 +33,10 @@ hexo.extend.generator.register("feed", (locals) => {
// Rendering for podcasts
locals.posts.sort('date', -1).each(function (post) {
if (!post.podcast) return;
+ let description = post.content.replaceAll(/onclick=".*?"/gi, '');
feed.addItem({
title: post.title,
- description: post.content,
+ description: description.replace(/>\s+</g, '><', ''),
url: config.url + urler(post.path),
guid: config.url + urler(post.path),
author: post.podcast.authors.join(', '),
diff --git a/scripts/meta.js b/scripts/meta.js
index 9b4a779..046e939 100644
--- a/scripts/meta.js
+++ b/scripts/meta.js
@@ -31,6 +31,7 @@ hexo.extend.tag.register('timeline', function (_args) {
let page = this;
if (!(page.podcast && page.podcast.chapters))
return;
+ const urler = hexo.extend.helper.get("full_url_for").bind(hexo);
return ejs.render(`
<ul>
<% (page.podcast.chapters).forEach(function(item) { %>
@@ -42,9 +43,13 @@ hexo.extend.tag.register('timeline', function (_args) {
const second = Math.floor(timestamp % 60);
const viewstr = String(hour).padStart(2, '0') + ':' + String(minute).padStart(2, '0') + ':' + String(second).padStart(2, '0');
%>
- <li class="is-family-monospace"><a href="#t=<%= viewstr %>" onclick="eval('player.seek(<%= timestamp %>)')"><%= viewstr %></a> <%= title %></li>
+ <li class="is-family-monospace">
+ <a href="<%= urler(page.path) %>#t=<%= viewstr %>" onclick="eval('player.seek(<%= timestamp %>)')">
+ <%= viewstr %>
+ </a><%= title %>
+ </li>
<% }); %>
</ul>
`
- , {page: page});
+ , {page: page, urler: urler});
})