While this is a very nice explanation of the traps we can fall in using that code, it does not explain the main question: In a single page (e.g. Robots ↭ GoHugo Components ↭ KOLLITSCH.dev*), a shortcode using page
should show the table you can see now. It does not. The page
method returns values for a page Archives
which is not in that specific section. It’s the first page object in the filesystem of content
.
.Page
shows the right information. Replacing with .Page
solves the issue, so I am closing this topic.
This doesn’t explain why page
works on the first occurrence of the single pages (the latest entry in the section) and not on subsequent ones.
Using .Summary
on list pages is another way not to get trapped by the context of the function.