Browse Source

Fix displaying Staticman comments

tags/v1.0.0
hawkeye116477 6 years ago
parent
commit
a79054de0b
No account linked to committer's email address
1 changed files with 4 additions and 3 deletions
  1. 4
    3
      layouts/partials/post_comments.html

+ 4
- 3
layouts/partials/post_comments.html View File

@@ -1,11 +1,13 @@
{{ if .Site.Data.blog.staticmanComments.enable }}
<section class="mt-4">
<h3>{{ i18n "comments" }}</h3>

{{ $postSlug := .File.BaseFileName }}
{{ $.Scratch.Add "entryId" $postSlug }}
{{ $comments := index $.Site.Data.comments ($.Scratch.Get "entryId") }}

{{ $.Scratch.Set "hasComments" 0 }}
{{ if .Site.Data.comments }}
{{ $comments := index $.Site.Data.comments ($.Scratch.Get "entryId") }}
{{ range $comments }}
{{ $.Scratch.Add "hasComments" 1 }}
{{ if not .reply_to }}
@@ -59,8 +61,7 @@
{{ end }}
{{ end }}
{{ end }}


{{ end }}
{{ if eq ($.Scratch.Get "hasComments") 0 }}
<p>{{ i18n "noComments" }}</p>
{{ end }}

Loading…
Cancel
Save