{{ $newsPath := (printf "data/%s/news/news.toml" $.Language.Lang) }} {{ $newsData := "" }} {{ if (fileExists $newsPath) -}} {{ $data := index .Site.Data $.Language.Lang }} {{ $newsData = $data.news }} {{ else }} {{ $dataDefaultLanguage := index .Site.Data .Sites.Default.Language.Lang }} {{ $newsData = $dataDefaultLanguage.news }} {{ end }} {{ with $newsData.news }} {{ $newsCounter := 0 }} {{ $newsDayCounter := 1 }} {{ $newsDayPrev := false }} {{ range (sort .news "date" "desc") }} {{ if lt $newsCounter 6 }} {{ $newsDayCur := dateFormat "2006-01-02" .date }} {{ if eq $newsDayCur $newsDayPrev }} {{ $newsDayCounter = add $newsDayCounter 1 }} {{ else }} {{ $newsDayCounter = 1 }} {{ end }}

{{ dateFormat "2006-01-02" .date }}
{{ if .title }} {{ $title := replaceRE "" "" .title }} {{ $title = replaceRE "" "" $title }} {{ $title | safeHTML }} {{ else }} {{ $description := replaceRE "" "" .description }} {{ $description = replaceRE "" "" $description }} {{ $description | safeHTML }} {{ end }}

{{ $newsCounter = add $newsCounter 1 }} {{ $newsDayPrev = $newsDayCur }} {{ end }} {{ end }} {{ end }}