diff --git a/atom.xml b/atom.xml index 36f16d4..9675751 100644 --- a/atom.xml +++ b/atom.xml @@ -5,9 +5,9 @@ {% if config.subtitle %}{{ config.subtitle }}{% endif %} {% if config.feed.hub %}{% endif %} - + {{ posts.first().updated.toISOString() }} - {{ url }} + {{ url | uriencode }} {% if config.author %} {{ config.author }} @@ -18,8 +18,8 @@ {% for post in posts.toArray() %} {{ post.title }} - - {{ url }}{{ post.path }} + + {{ post.permalink | uriencode }} {{ post.date.toISOString() }} {{ post.updated.toISOString() }} {% if config.feed.content and post.content %} @@ -47,13 +47,13 @@ {% endif %} {% if post.image %} - + {% endif %} {% for category in post.categories.toArray() %} - + {% endfor %} {% for tag in post.tags.toArray() %} - + {% endfor %} {% endfor %} diff --git a/lib/generator.js b/lib/generator.js index 00b595c..33b2e1e 100644 --- a/lib/generator.js +++ b/lib/generator.js @@ -4,10 +4,10 @@ const nunjucks = require('nunjucks'); const env = new nunjucks.Environment(); const { join } = require('path'); const { readFileSync } = require('fs'); -const { gravatar } = require('hexo-util'); +const { encodeURL, gravatar } = require('hexo-util'); env.addFilter('uriencode', str => { - return encodeURI(str); + return encodeURL(str); }); env.addFilter('noControlChars', str => { diff --git a/rss2.xml b/rss2.xml index 927bba7..3fe7ac4 100644 --- a/rss2.xml +++ b/rss2.xml @@ -13,8 +13,8 @@ {% for post in posts.toArray() %} {{ post.title }} - {{ url }}{{ post.path | uriencode }} - {{ url }}{{ post.path | uriencode }} + {{ post.permalink | uriencode }} + {{ post.permalink | uriencode }} {{ post.date.toDate().toUTCString() }} {% if post.description %} @@ -38,12 +38,12 @@ {% endif %} {% if post.image %} - + {% endif %} {% if config.feed.content and post.content %} {% endif %} - {% if post.comments %}{{ url }}{{ post.path | uriencode }}#disqus_thread{% endif %} + {% if post.comments %}{{ post.permalink | uriencode }}#disqus_thread{% endif %} {% endfor %}