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

{{ if .Site.Data.blog.staticmanComments.enable }} {{ if .Site.Data.blog.staticmanComments.enable }}
<section class="mt-4"> <section class="mt-4">
<h3>{{ i18n "comments" }}</h3> <h3>{{ i18n "comments" }}</h3>

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


{{ $.Scratch.Set "hasComments" 0 }} {{ $.Scratch.Set "hasComments" 0 }}
{{ if .Site.Data.comments }}
{{ $comments := index $.Site.Data.comments ($.Scratch.Get "entryId") }}
{{ range $comments }} {{ range $comments }}
{{ $.Scratch.Add "hasComments" 1 }} {{ $.Scratch.Add "hasComments" 1 }}
{{ if not .reply_to }} {{ if not .reply_to }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ end }} {{ end }}


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

Loading…
Cancel
Save