diff --git a/layout/_partials/post/post-copyright.njk b/layout/_partials/post/post-copyright.njk
index f0e9c97..84da3eb 100644
--- a/layout/_partials/post/post-copyright.njk
+++ b/layout/_partials/post/post-copyright.njk
@@ -18,7 +18,7 @@
{{ next_url(page.post_link, page.post_link, {title: page.title}) }}
{%- else %}
{{ __('post.copyright.link') + __('symbol.colon') }}
- {{ next_url(page.permalink, page.permalink, {title: page.title}) }}
+ {{ next_url(page.permalink, page.permalink, {title: page.title}, true) }}
{%- endif %}
diff --git a/scripts/helpers/next-url.js b/scripts/helpers/next-url.js
index 9cb49cc..9f88b58 100644
--- a/scripts/helpers/next-url.js
+++ b/scripts/helpers/next-url.js
@@ -3,7 +3,7 @@
const { htmlTag } = require('hexo-util');
const { parse } = require('url');
-module.exports = function(path, text, options = {}) {
+module.exports = function(path, text, options = {}, decode = false) {
const { config, theme } = this;
const data = parse(path);
const siteHost = parse(config.url).hostname || config.url;
@@ -50,5 +50,5 @@ module.exports = function(path, text, options = {}) {
}
}
- return htmlTag(tag, attrs, decodeURI(text), false);
+ return htmlTag(tag, attrs, decode ? decodeURI(text) : text, false);
};
diff --git a/test/helpers/next-url.js b/test/helpers/next-url.js
index 20c4088..ea781ad 100644
--- a/test/helpers/next-url.js
+++ b/test/helpers/next-url.js
@@ -32,6 +32,10 @@ describe('next-url', () => {
nextUrl('https://theme-next.js.org', 'Text').should.eql('Text');
});
+ it('decodeURI', () => {
+ (() => nextUrl('https://theme-next.js.org', 'A % B')).should.not.throw();
+ });
+
it('exturl enabled', () => {
hexo.theme.exturl = true;
const encoded = btoa('https://theme-next.js.org');