Merge pull request #128 from yogster/master

Fixes https://github.com/halogenica/beautifulhugo/issues/111
This commit is contained in:
Michael Romero 2018-02-08 23:25:22 -05:00 committed by GitHub
commit 7cb1aa8aea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 14 deletions

View file

@ -12,15 +12,17 @@
{{- if .Site.Params.staticman -}}
&nbsp;|&nbsp; <i class="fa fa-comment-o"></i>
{{ $slug := replace .URL "/" "" }}
{{ $comments := index $.Site.Data.comments $slug }}
{{ if $comments }}
{{ if gt (len $comments) 1 }}
{{ len $comments }} {{ i18n "moreComment" }}
{{ if .Site.Data.comments }}
{{ $comments := index $.Site.Data.comments $slug }}
{{ if $comments }}
{{ if gt (len $comments) 1 }}
{{ len $comments }} {{ i18n "moreComment" }}
{{ else }}
{{ len $comments }} {{ i18n "oneComment" }}
{{ end }}
{{ else }}
{{ len $comments }} {{ i18n "oneComment" }}
0 {{ i18n "oneComment" }}
{{ end }}
{{ else }}
0 {{ i18n "oneComment" }}
{{ end }}
{{ end }}
{{ if .IsTranslated -}}

View file

@ -2,15 +2,17 @@
{{ $slug := replace .URL "/" "" }}
{{ $comments := index $.Site.Data.comments $slug }}
{{ if $comments }}
{{ if gt (len $comments) 1 }}
<h3>{{ len $comments }} {{ i18n "moreComment" }}</h3>
{{ if .Site.Data.comments }}
{{ $comments := index $.Site.Data.comments $slug }}
{{ if $comments }}
{{ if gt (len $comments) 1 }}
<h3>{{ len $comments }} {{ i18n "moreComment" }}</h3>
{{ else }}
<h3>{{ len $comments }} {{ i18n "oneComment" }}</h3>
{{ end }}
{{ else }}
<h3>{{ len $comments }} {{ i18n "oneComment" }}</h3>
<h3>{{ i18n "noComment" }}</h3>
{{ end }}
{{ else }}
<h3>{{ i18n "noComment" }}</h3>
{{ end }}
{{ $.Scratch.Set "hasComments" 0 }}