How to Read Page Matters in Page Listing Layout

For every child pages, they have front matter such that:

+++
...

[thumbnails.0]
url = "https://to.a.picture.1"
...

[thumbnails.1]
url = "https://to.a.picture.1"
...

+++

In the index page (list layout), while I can list every single page, how can I access each pages’ front matter’s thumbnails, and subsequently, thumbnails.0.url when I range each page of the list?

Currently, I’m able to process page title and description but I want my thumbnails URLs back for each pages.

I tried GetPage but it always give nil.

Thanks for the help in advanced.


Some failed attempts:

{{- $page := . -}}
{{- range $u := .Pages.ByTitle -}}

{{- $t := .Site.GetPage $u.RelPermalink -}}
{{- printf "Site.GetPage = |%#v|\n" $t -}} 

{{- $t := $page.GetPage $u.RelPermalink -}}
{{- printf "Page.GetPage = |%#v|\n" $t -}}  

{{- end -}

Found my answer. Instead of get each pages, you can use the param function instead. So to improve the example code, this will work:

{{- range $u := .Pages.ByTitle -}}
        {{- $thumbnails := $u.Param "thumbnails" -}}
        ...
{{- end -}}

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.