Skip to content

Commit

Permalink
fix(IDN): uriencode root value
Browse files Browse the repository at this point in the history
  • Loading branch information
curbengh committed Oct 17, 2019
1 parent a513323 commit 3231cce
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
14 changes: 7 additions & 7 deletions atom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
{% if config.subtitle %}<subtitle>{{ config.subtitle }}</subtitle>{% endif %}
<link href="{{ feed_url | uriencode }}" rel="self"/>
{% if config.feed.hub %}<link href="{{ config.feed.hub | uriencode }}" rel="hub"/>{% endif %}
<link href="{{ url }}"/>
<link href="{{ url | uriencode }}"/>
<updated>{{ posts.first().updated.toISOString() }}</updated>
<id>{{ url }}</id>
<id>{{ url | uriencode }}</id>
{% if config.author %}
<author>
<name>{{ config.author }}</name>
Expand All @@ -18,8 +18,8 @@
{% for post in posts.toArray() %}
<entry>
<title>{{ post.title }}</title>
<link href="{{ url }}{{ post.path | uriencode }}"/>
<id>{{ url }}{{ post.path }}</id>
<link href="{{ post.permalink | uriencode }}"/>
<id>{{ post.permalink | uriencode }}</id>
<published>{{ post.date.toISOString() }}</published>
<updated>{{ post.updated.toISOString() }}</updated>
{% if config.feed.content and post.content %}
Expand Down Expand Up @@ -47,13 +47,13 @@
{% endif %}
</summary>
{% if post.image %}
<content src="{{ url }}{{ post.image | uriencode }}" type="image" />
<content src="{{ url + post.image | uriencode }}" type="image" />
{% endif %}
{% for category in post.categories.toArray() %}
<category term="{{ category.name }}" scheme="{{ url }}{{ category.path | uriencode }}"/>
<category term="{{ category.name }}" scheme="{{ url + category.path | uriencode }}"/>
{% endfor %}
{% for tag in post.tags.toArray() %}
<category term="{{ tag.name }}" scheme="{{ url }}{{ tag.path | uriencode }}"/>
<category term="{{ tag.name }}" scheme="{{ url + tag.path | uriencode }}"/>
{% endfor %}
</entry>
{% endfor %}
Expand Down
4 changes: 2 additions & 2 deletions lib/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down
8 changes: 4 additions & 4 deletions rss2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
{% for post in posts.toArray() %}
<item>
<title>{{ post.title }}</title>
<link>{{ url }}{{ post.path | uriencode }}</link>
<guid>{{ url }}{{ post.path | uriencode }}</guid>
<link>{{ post.permalink | uriencode }}</link>
<guid>{{ post.permalink | uriencode }}</guid>
<pubDate>{{ post.date.toDate().toUTCString() }}</pubDate>
<description>
{% if post.description %}
Expand All @@ -38,12 +38,12 @@
{% endif %}
</description>
{% if post.image %}
<enclosure url="{{ url + post.image }}" type="image" />
<enclosure url="{{ url + post.image | uriencode }}" type="image" />
{% endif %}
{% if config.feed.content and post.content %}
<content:encoded><![CDATA[{{ post.content | noControlChars | safe }}]]></content:encoded>
{% endif %}
{% if post.comments %}<comments>{{ url }}{{ post.path | uriencode }}#disqus_thread</comments>{% endif %}
{% if post.comments %}<comments>{{ post.permalink | uriencode }}#disqus_thread</comments>{% endif %}
</item>
{% endfor %}
</channel>
Expand Down

0 comments on commit 3231cce

Please sign in to comment.