Optimize the path setting of LiveRe & Valine

* See: https://github.com/next-theme/hexo-theme-next/issues/97
This commit is contained in:
Mimi 2020-08-24 00:54:53 +08:00
parent ae9e1407ea
commit 5e1b0d0e8c
2 changed files with 2 additions and 2 deletions

View File

@ -2,7 +2,7 @@
<script>
NexT.utils.loadComments('#lv-container', () => {
window.livereOptions = {
refer: location.pathname.replace(CONFIG.root, '').replace('index.html', '')
refer: {{ page.path | replace(r/index\.html$/, '') | safedump }}
};
(function(d, s) {
var j, e = d.getElementsByTagName(s)[0];

View File

@ -3,7 +3,7 @@ NexT.utils.loadComments('#valine-comments', () => {
NexT.utils.getScript('{{ theme.vendors.valine }}', () => {
new Valine(Object.assign({
el : '#valine-comments',
path: location.pathname,
path: {{ url_for(page.path) | replace(r/index\.html$/, '') | safedump }},
}, {{ theme.valine | safedump }}
));
}, window.Valine);