mirror of
https://github.com/next-theme/hexo-theme-next.git
synced 2026-01-18 18:33:42 +00:00
Rename json to safedump
This commit is contained in:
parent
53a220f398
commit
19054432ba
@ -6,7 +6,7 @@
|
||||
<script{{ pjax }} id="page-configurations">
|
||||
// https://hexo.io/docs/variables.html
|
||||
CONFIG.page = {
|
||||
sidebar: {{ page.sidebar | json }},
|
||||
sidebar: {{ page.sidebar | safedump }},
|
||||
isHome : {{ is_home() }},
|
||||
isPost : {{ is_post() }},
|
||||
lang : '{{ page.lang }}'
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
};
|
||||
|
||||
// Read config form theme config file
|
||||
Object.assign(calendar, {{ theme.calendar | json }});
|
||||
Object.assign(calendar, {{ theme.calendar | safedump }});
|
||||
|
||||
var now = new Date();
|
||||
var timeMax = new Date();
|
||||
|
||||
6
layout/_third-party/comments/disqus.njk
vendored
6
layout/_third-party/comments/disqus.njk
vendored
@ -13,9 +13,9 @@
|
||||
{%- if page.comments %}
|
||||
<script>
|
||||
var disqus_config = function() {
|
||||
this.page.url = {{ page.permalink | json }};
|
||||
this.page.identifier = {{ page.path | json }};
|
||||
this.page.title = {{ page.title | json }};
|
||||
this.page.url = {{ page.permalink | safedump }};
|
||||
this.page.identifier = {{ page.path | safedump }};
|
||||
this.page.title = {{ page.title | safedump }};
|
||||
{% if __('disqus') !== 'disqus' -%}
|
||||
this.language = '{{ __('disqus') }}';
|
||||
{% endif -%}
|
||||
|
||||
6
layout/_third-party/comments/disqusjs.njk
vendored
6
layout/_third-party/comments/disqusjs.njk
vendored
@ -11,9 +11,9 @@ NexT.utils.loadComments(document.querySelector('#disqus_thread'), () => {
|
||||
api : '{{ theme.disqusjs.api }}' || 'https://disqus.com/api/',
|
||||
apikey : '{{ theme.disqusjs.apikey }}',
|
||||
shortname : '{{ theme.disqusjs.shortname }}',
|
||||
url : {{ page.permalink | json }},
|
||||
identifier: {{ page.path | json }},
|
||||
title : {{ page.title | json }},
|
||||
url : {{ page.permalink | safedump }},
|
||||
identifier: {{ page.path | safedump }},
|
||||
title : {{ page.title | safedump }},
|
||||
});
|
||||
}, window.DisqusJS);
|
||||
});
|
||||
|
||||
2
layout/_third-party/comments/valine.njk
vendored
2
layout/_third-party/comments/valine.njk
vendored
@ -6,7 +6,7 @@ NexT.utils.loadComments(document.querySelector('#valine-comments'), () => {
|
||||
new Valine(Object.assign({
|
||||
el : '#valine-comments',
|
||||
path: location.pathname,
|
||||
}, {{ theme.valine | json }}
|
||||
}, {{ theme.valine | safedump }}
|
||||
));
|
||||
}, window.Valine);
|
||||
});
|
||||
|
||||
@ -61,7 +61,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
let { app_id, app_key, server_url } = {{ theme.leancloud_visitors | json }};
|
||||
let { app_id, app_key, server_url } = {{ theme.leancloud_visitors | safedump }};
|
||||
function fetchData(api_server) {
|
||||
var Counter = (method, url, data) => {
|
||||
return fetch(`${api_server}/1.1${url}`, {
|
||||
|
||||
@ -10,7 +10,7 @@ function njkCompile(data) {
|
||||
const env = nunjucks.configure(templateDir, {
|
||||
autoescape: false
|
||||
});
|
||||
env.addFilter('json', dictionary => {
|
||||
env.addFilter('safedump', dictionary => {
|
||||
if (typeof dictionary !== 'undefined' && dictionary !== null) {
|
||||
return JSON.stringify(dictionary);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user