Homepage content from content/home.md

That was one of my tries.

It works for single content pages such as content/_index/index.md or content/_index/hero.md, but as bep confirmed it is not ready for single page apps, which basically provider multiple files for this.

It basically errors on using content/_index/ with multiple files. I would love this to work as that is the cleanest method.

Afaik this would solve the index.xml issue, the /index/ not 404 issue and issues with the sitemap.

I’ve been struggling to find a way to choose which content files to generate or not the pages. For now, only data files, but they have other issues (like the dammed trimmed <p>).

A folder called _index/ causes panic: Too many homes error on version 0.18.

We really need a way to hide a folder of .md files.

Just wondering if there has been any more development with this.

I have a page in the content folder content/about.md whose contents I would like to render on the home page. So far this is the only thing that worked for me:

{{ range (where .Pages "Title" "About") }}
    {{ .Content }}
{{ end }}

Is there a better solution for rendering a single content page that is not part of a section?

I believe this will work @Toma:

{{ with $.Site.GetPage "page" "about" }}{{.Content}}{{end}}
1 Like

Hey @rdwatters, that didn’t work but this did:

{{ with $.Site.GetPage "page" "about.md" }}{{.Content}}{{end}}

Btw, what does with and the $ do here?

1 Like

with checks for the existence of whatever’s being passed and then rebinds the context (i.e., .) within its scope:

$ tells Hugo to look to the top-level context.

.Site.GetPage is a really cool, and often underutilized, function:

1 Like

Ah ok, thank you for the explanation. .Site.GetPage was one of the things I tried initially but didn’t get the syntax quite right.

Is there a Hugo doc page that shows all of the different parameters or arguments that can be passed into .Site.GetPage? Like “page” and “section” and “Title”?