.Site.GetPage empty

I’ve recently upgraded to 0.80 and a site built using 0.59 is not returning content for the following code:

  {{ with .Site.GetPage "index.md" }}
  {{ .Params.Details | safe.HTML }}
  {{ end }}

It’s a single-page site (index.html only) and all the page content is in index.md within the content folder. I can’t find any detail about .Site.GetPage usage changing?

Any help appreciated!

Rename index.md to _index.md.

├── content
│   └── _index.md
└── layouts
    └── _default
        ├── baseof.html
        └── index.html

I don’t understand why you need to use .GetPage with a single page site, but if you must, any of these will work:

{{ with .Site.GetPage "_index.md" }}
{{ with .Site.GetPage "home" }}
{{ with .Site.GetPage "" }}

Wonderful. Thanks for your help!
I’ve also removed the {{ with .Site.GetPage }} statements as you suggest.
(I’m unsure why I used them in an earlier version of the site but I do remember struggling to build a single index.html page.)

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