diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/feed.js | 7 | ||||
-rw-r--r-- | scripts/meta.js | 3 |
2 files changed, 8 insertions, 2 deletions
diff --git a/scripts/feed.js b/scripts/feed.js index 87e672b..f1a2fc9 100644 --- a/scripts/feed.js +++ b/scripts/feed.js @@ -6,6 +6,7 @@ hexo.extend.generator.register("feed", (locals) => { const config = hexo.config; const theme = hexo.theme.config; const urler = hexo.extend.helper.get("url_for").bind(hexo); + const fullurl = hexo.extend.helper.get("full_url_for").bind(hexo); const hstrip = hexo.extend.helper.get("strip_html").bind(hexo); if (!theme.rss || !theme.rss.enable) return; @@ -54,6 +55,12 @@ hexo.extend.generator.register("feed", (locals) => { .replace(/id=".*?"/gi, '').replace(/rel=".*?"/gi, '') .replace(/title=".*?"/gi, '').replace(/\n/g, "") .replace(/\s+/g, ' ').trim(); + + // Check local media url + let url = post.podcast.media.url; + if (!(url.startsWith("http://") || url.startsWith("https://"))) + url = fullurl(post.path, {relative: false}).replace("index.html", '') + url; + feed.addItem({ title: post.title, description: description, diff --git a/scripts/meta.js b/scripts/meta.js index 23311a6..208358e 100644 --- a/scripts/meta.js +++ b/scripts/meta.js @@ -31,7 +31,6 @@ 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) { %> @@ -51,5 +50,5 @@ hexo.extend.tag.register('timeline', function (_args) { <% }); %> </ul> ` - , {page: page, urler: urler}); + , {page: page}); }); |