How to access the last (most recent) page?


Hello everyone

Is there a way to point to the latest page on my site (that is the page which has the most recent date)? I would then want to extract some information from it, something along the lines of .MostRecent.Content

Is this possible?

Working around not-so-random randomness

I would need to know if you’re talking about in a section, taxonomy, or just the site overall. But first look at ordering by the lastmod field:

And then use the first func.


Thank you, this is exactly what I was looking for. The code

{{ range first 1 .Data.Pages.ByDate.Reverse }}
    {{ .Content }}
{{ end }}

gave me the first page, chronologically speaking (= the most recent by date)