1{%- include snippets/get-sources.html -%} 2{%- assign _sources = __return -%} 3 4{%- assign _VALINE_APP_ID = site.comments.valine.app_id -%} 5{%- assign _VALINE_APP_KEY = site.comments.valine.app_key -%} 6{%- assign _VALINE_PLACEHOLDER = site.comments.valine.placeholder -%} 7 8 9{%- if page.key and 10 _VALINE_APP_ID and 11 _VALINE_APP_KEY -%} 12 13<div id="vcomments"></div> 14<script> 15 window.Lazyload.js(['{{ _sources.leancloud_js_sdk}}', '{{ _sources.valine }}'], function() { 16 var _config = { 17 el: '#vcomments', 18 appId: '{{ _VALINE_APP_ID }}', 19 appKey: '{{ _VALINE_APP_KEY }}', 20 verify: true, 21 }; 22 {%- if _VALINE_PLACEHOLDER -%} 23 _config.placeholder = '{{ _VALINE_PLACEHOLDER }}'; 24 {%- endif -%} 25 {%- assign _page_lang_slice = page.lang | slice: 0, 2 -%} 26 {%- if _page_lang_slice != 'zh' -%} 27 _config.lang = 'en'; 28 {%- endif -%} 29 new Valine(_config); 30 }); 31</script> 32 33{%- endif -%}