diff --git a/themes/chameleon/scripts/feed/.atom.xml b/themes/chameleon/scripts/feed/.atom.xml index 17480f8..b78d9e5 100644 --- a/themes/chameleon/scripts/feed/.atom.xml +++ b/themes/chameleon/scripts/feed/.atom.xml @@ -1,29 +1,29 @@ - + {{ config.title }} {% if icon %}{{ icon }}{% endif %} {% if config.subtitle %}{{ config.subtitle }}{% endif %} {% if config.feed.hub %}{% endif %} - - {{ posts.first().date | date }} - {{ url }} + + {{ posts.first().updated.toISOString() }} + {{ url | uriencode }} {% if config.author %} {{ config.author }} {% if config.email %}{{ config.email }}{% endif %} {% endif %} - Hexo + Hexo {% for post in posts.toArray() %} {{ post.title }} - - {{ url }}{{ post.path }} - {{ post.date | date }} + + {{ post.permalink }} + {{ post.date.toISOString() }} {% if post.lastUpdated %}{{ post.lastUpdated | date }}{% else %}{{ post.date | date }}{% endif %} {% if config.feed.content and post.content %} - + {% endif %} {% if post.description %} @@ -47,13 +47,10 @@ {% endif %} {% if post.image %} - + {% endif %} - {% for category in post.categories.toArray() %} - - {% endfor %} {% for tag in post.tags.toArray() %} - + {% endfor %} {% endfor %} diff --git a/themes/chameleon/scripts/feed/generator.js b/themes/chameleon/scripts/feed/generator.js index 81af888..cf73997 100644 --- a/themes/chameleon/scripts/feed/generator.js +++ b/themes/chameleon/scripts/feed/generator.js @@ -2,8 +2,8 @@ const nunjucks = require('nunjucks') const env = new nunjucks.Environment() -const pathFn = require('path') -const fs = require('fs') +const { join } = require('path') +const { readFileSync } = require('fs') const moment = require('moment') env.addFilter('uriencode', str => { @@ -18,8 +18,8 @@ env.addFilter('date', str => { return moment(str).format('YYYY-MM-DD[T00:00:00.000Z]') }) -const atomTmplSrc = pathFn.join(__dirname, './.atom.xml') -const atomTmpl = nunjucks.compile(fs.readFileSync(atomTmplSrc, 'utf8'), env) +const atomTmplSrc = join(__dirname, './.atom.xml') +const atomTmpl = nunjucks.compile(readFileSync(atomTmplSrc, 'utf8'), env) module.exports = function (locals) { const config = this.config diff --git a/themes/chameleon/scripts/feed/index.js b/themes/chameleon/scripts/feed/index.js index 4db03cf..4c72551 100644 --- a/themes/chameleon/scripts/feed/index.js +++ b/themes/chameleon/scripts/feed/index.js @@ -7,7 +7,7 @@ * to use post.lastUpdated and remove timezone */ -const pathFn = require('path') +const { extname } = require('path') const config = hexo.config.feed = Object.assign({ type: 'atom', @@ -25,7 +25,7 @@ if (!config.path) { } // Add extension name if don't have -if (!pathFn.extname(config.path)) { +if (!extname(config.path)) { config.path += '.xml' }