33 lines
929 B
HTML
33 lines
929 B
HTML
|
{%- include snippets/get-sources.html -%}
|
||
|
{%- assign _sources = __return -%}
|
||
|
|
||
|
{%- assign _VALINE_APP_ID = site.comments.valine.app_id -%}
|
||
|
{%- assign _VALINE_APP_KEY = site.comments.valine.app_key -%}
|
||
|
{%- assign _VALINE_PLACEHOLDER = site.comments.valine.placeholder -%}
|
||
|
|
||
|
|
||
|
{%- if page.key and
|
||
|
_VALINE_APP_ID and
|
||
|
_VALINE_APP_KEY -%}
|
||
|
|
||
|
<div id="vcomments"></div>
|
||
|
<script>
|
||
|
window.Lazyload.js(['{{ _sources.leancloud_js_sdk}}', '{{ _sources.valine }}'], function() {
|
||
|
var _config = {
|
||
|
el: '#vcomments',
|
||
|
appId: '{{ _VALINE_APP_ID }}',
|
||
|
appKey: '{{ _VALINE_APP_KEY }}',
|
||
|
verify: true,
|
||
|
};
|
||
|
{%- if _VALINE_PLACEHOLDER -%}
|
||
|
_config.placeholder = '{{ _VALINE_PLACEHOLDER }}';
|
||
|
{%- endif -%}
|
||
|
{%- assign _page_lang_slice = page.lang | slice: 0, 2 -%}
|
||
|
{%- if _page_lang_slice != 'zh' -%}
|
||
|
_config.lang = 'en';
|
||
|
{%- endif -%}
|
||
|
new Valine(_config);
|
||
|
});
|
||
|
</script>
|
||
|
|
||
|
{%- endif -%}
|