diff options
-rw-r--r-- | layout/_partial/head.ejs | 5 | ||||
-rw-r--r-- | scripts/feed.js | 7 | ||||
-rw-r--r-- | scripts/meta.js | 9 |
3 files changed, 16 insertions, 5 deletions
diff --git a/layout/_partial/head.ejs b/layout/_partial/head.ejs index c145c9a..b4cb09e 100644 --- a/layout/_partial/head.ejs +++ b/layout/_partial/head.ejs @@ -18,6 +18,11 @@ <meta name="description" content="<%= config.description %>"> <% } %> + <!-- RSS Autodiscovery --> + <% if (theme.rss.enable) { %> + <link rel="alternate" href="<%= theme.rss.path %>" type="application/rss+xml"> + <% } %> + <!-- Scripts and styles --> <style>pre{background-color:none!important;padding:0%!important;}@media(prefers-color-scheme:dark){*{transition:backgourd-color .5s}.card{box-shadow:none!important;background-color:#121212!important}}@media screen and (max-width:1023px){.navbar-menu{box-shadow:0 8px 16px -8px rgb(10 10 10 / 10%)!important}.post-content{padding-top:0!important}.post-card{margin:0 0 0 0!important}}.post-podcast-player{padding-bottom:1.5rem}.post-card{margin:0 1rem 0rem 1rem}.navbar-brand .navbar-item:hover{background-color:inherit!important}.entry{margin-bottom:1.5rem!important;margin-top:1.5rem!important;transition:box-shadow .1s}.entry:hover{box-shadow:0 1em 2em -0.125em rgb(10 10 10 / 10%),0 0 0 1px rgb(10 10 10 / 2%)}.pagination-bar{padding-left:.25rem;padding-right:.25rem}.footer{padding:1rem 1rem 1rem!important;background-color:transparent!important}</style> <link rel="preload" as="style" onload="this.rel='stylesheet'" href="https://cdn.jsdelivr.net/npm/bulma/css/bulma.min.css"> 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}); }) |