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,6 +12,7 @@
{{- if .Site.Params.staticman -}} {{- if .Site.Params.staticman -}}
&nbsp;|&nbsp; <i class="fa fa-comment-o"></i> &nbsp;|&nbsp; <i class="fa fa-comment-o"></i>
{{ $slug := replace .URL "/" "" }} {{ $slug := replace .URL "/" "" }}
{{ if .Site.Data.comments }}
{{ $comments := index $.Site.Data.comments $slug }} {{ $comments := index $.Site.Data.comments $slug }}
{{ if $comments }} {{ if $comments }}
{{ if gt (len $comments) 1 }} {{ if gt (len $comments) 1 }}
@ -23,6 +24,7 @@
0 {{ i18n "oneComment" }} 0 {{ i18n "oneComment" }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ end }}
{{ if .IsTranslated -}} {{ if .IsTranslated -}}
{{- $sortedTranslations := sort .Translations "Site.Language.Weight" -}} {{- $sortedTranslations := sort .Translations "Site.Language.Weight" -}}
{{- $links := apply $sortedTranslations "partial" "translation_link.html" "." -}} {{- $links := apply $sortedTranslations "partial" "translation_link.html" "." -}}

View file

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