I tried to include a partial template inside index.html
{{ partial "foo.html" . }}
Inside foo.html
, I have this
{{ range .Data.Pages }}
...
{{ end }}
Strangely, nothing is shown.
Is the .Data.Pages
variable not available even when passing context?
Hi there,
For places where .Data.Pages
do not work, use .Site.Recent
(Hugo v0.12) or .Site.Pages
(Hugo v0.13-DEV on). See http://gohugo.io/templates/variables/ for more information.
But of course, if you do not yet have any pages inside the content/
directory, then neither .Data.Pages
nor .Site.Recent
/.Site.Pages
would show anything.
2 Likes