[SOLVED] readingTime, datePosted, LastUpdates, etc in HOMEPAGE (aka index)

Hi there,

This is my first post.

I’ve been creating my first website with Hugo, and just to say that I love it :slight_smile:

Well, I’d like to build a one-pager website (a huge post) and I’d like to have the readingTime and the LastUpdates to appear like if it was a normal post.

I cannot figure out how to do it.

I’m trying to write readingTime on true on the index page, etc
It looks like the index page doesn’t act like a normal post for this.

How could I find a solution for this?

Best Regards

To be more precise, I would like the following code to be valid for the homepage

{{ $lastmodstr := default (i18n “dateFormat”) .Site.Params.dateformat | .Lastmod.Format }}
{{ $datestr := default (i18n “dateFormat”) .Site.Params.dateformat | .Date.Format }}
 {{ $datestr | i18n “postedOnDate”}}
{{ if ne $datestr $lastmodstr }}
 {{ $lastmodstr | i18n “lastModified” }}
{{ end }}
{{ if .Site.Params.readingTime }}
 | 
{{ i18n “readingTime”}} {{ .ReadingTime }} {{ i18n “readTime” }} ({{ .WordCount }} {{ i18n “words” }})
{{ end }}
{{- if .Site.Params.staticman -}}
 | 
{{ $slug := replace .URL “/” “” }}
{{ 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 }}
0 {{ i18n “oneComment” }}
{{ end }}
{{ end }}
{{ end }}
{{ if .IsTranslated -}}
{{- $sortedTranslations := sort .Translations “Site.Language.Weight” -}}
{{- $links := apply $sortedTranslations “partial” “translation_link.html” “.” -}}
{{- $cleanLinks := apply $links “chomp” “.” -}}
{{- $linksOutput := delimit $cleanLinks (i18n “translationsSeparator”) -}}
 •  {{ i18n “translationsLabel” }}{{ $linksOutput }}
{{- end }}

For some reason, now that I’ve restarted my computer. I works! :slight_smile:

Maybe because I’ve installed the newer version of Hugo…