Welcome to mirror list, hosted at ThFree Co, Russian Federation.

comments.html « partials « layouts - github.com/wayjam/hugo-theme-mixedpaper.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 363d4f24ed8edb71d82ad6b73c4773f65676741a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<aside id="comments">
  {{- $comment := .Site.Params.comment}}
  {{- if or (eq $comment.type "none") (.Params.noComment) (eq .Type "section") }}
  {{- else if eq $comment.type "valine"}}
    {{- if $comment.valine.visitor -}}
      <span id="{{ .RelPermalink | relURL }}" class="leancloud_visitors" data-flag-title="{{ .Title }}">
				<span class="post-meta-item-text">文章阅读量</span>
				<span class="leancloud-visitors-count">0</span>
			</span>
    {{- end }}
    <div id="vcomments"></div>
    <script src="//unpkg.com/valine@latest/dist/Valine.min.js"></script>
    <script type="text/javascript">
          const meta = '{{- $comment.valine.meta }}'.split(',').filter(function (item) {
              return ['nick','mail','link'].indexOf(item) > -1;
          });
					const requiredFields = '{{- $comment.valine.requiredFields }}'.split(',').filter(function(item) {
						return ['nick', 'mail'].indexOf(item) > -1;
					})
          new Valine({
              el: '#vcomments',
              appId: '{{- $comment.valine.appid }}',
              appKey: '{{- $comment.valine.appkey }}',
              placeholder: '{{- $comment.valine.placeholder }}',
              avatar: '{{- $comment.valine.avatar }}',
              pageSize: '{{- $comment.valine.pageSize }}' || 10,
              visitor: {{- $comment.valine.visitor }},
							highlight: {{- $comment.valine.highlight }},
							recordIP: {{- $comment.valine.recordIP }},
						  requiredFields: requiredFields || undefined,
              meta: meta || undefined,
      });
    </script>
  {{- else if eq $comment.type "disqus" }}
    {{ template "_internal/disqus.html" .}}
  {{- end }}
</aside>