How to set Section page as Homepage

Hi, I’m banging my head against a (what I feel) very small issue I can’t seem to find answer anywhere.
So here it goes: It’s a very simple portfolio website with a list of projects and list of posts.

To make it clean, I used a following structure:

Their layouts are defined by:

Now I want my homepage (index.html) to read off of the /work/list.html layout.
Right now my /layouts/index.html is blank.
For preview, I’m using localhost:1313/work/

One way would be to copy paste the /work/list.html code into /layouts/index.html, but that’s not very clean is it…? Also for some reason, when I try this, the whole page breaks down.

I really just want the website to load the project list as a homepage but keep the section list layout in /work/list.html

Am I making any sense?

If I understand correctly, the best way is to use mainSections.

Another alternative would be to do something like this:

{{ $paginator := .Paginate (cond .IsHome (where .Pages "Section" "work" ) (.Data.Pages) ) }}
{{ range $paginator.Pages }}
  {{ .Render "YourTemplate" }}
{{ end }}

IF .IsHome THEN use .Pages from "Section" "work" ELSE use .Data.Pages

I believe that is the correct syntax.

EDIT: User this in conjunction with blocks - as you suggest at the end.

1 Like

Actually a friend ended up enlightening me on the issue.

It’s really as simple as adding url = “/” to the frontmatter of /content/work/
That basically sets the ‘work’ section list page as the ‘root’

With that, the blank /layout/index.html is simply ignored and /work/list.html is loaded as the homepage.

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