Best approach to make my blog page the landing page

I am trying to make my blog page the actual landing page for my site. I found the perfect Hugo theme for my liking. However, I am struggling to get the blog link to be the actual landing page link, the proper way.

I want to try to do things the correct way so that I can always revert back if needed. I believe I have to edit my index.html page but I have struggled to figure it all out.

For example, I have

<!--- ADD HOME SECTION ---------------->
{{- partial "sections/home.html" . -}}

on this index page. The index page is under my themes/theme-name directory. I don’t want the “sections/home.html” at all, I simply want my blog page. The problem is, my blog page itself isn’t part of the partial section, I think. I’m going to paste my current code here: https://github.com/mtgingrass/test.github.io.git

Perhaps someone can direct me in the right direction.

Thanks.

The easiest way would be to copy the contents of the blog list template file to layouts/index.html.

1 Like

I would try to redirect the home page to the first blog

Change the header template … add (not tested!)

{{ if .IsHome -}}
{{ $pages := site.GetPage "/blog" }}
{{ range first 1 $pages.Pages }} 
  <meta http-equiv="refresh" content="0; url={{ .Permalink }}" />
{{ end }}
{{- end }}

When you say to copy the contents of the “blog list template file,” what file are you referring to? I think that’s part of the issue, I don’t know which file is serving up the blog page.

Here is the site: https://brave-jackson-b867d2.netlify.app/
Here is the blog page: Posts

There are just 3 layouts in the theme. baseof.html, list.html and single.html out of which only list.html is the one that can render the list of posts. So that must be it.

Create a file called layouts/index.html and in that, copy the contents from your theme’s layouts/_default/list.html. With some additional changes, it might work. Finally, in your content/posts folder, you can add an _index.md file with the frontmatter:

---
_build:
  render: false
---

So that Hugo won’t generate a page at the /posts/ path

1 Like

This suggestion got me very close. Thank you for the reply. It definitely made the blog page be the landing page. However, I would like this to be the default page: Posts

Basically, I want to avoid having to click on “posts” as well. I’ll play around with it and see if I can make that happen.

I think, if you copy the content from here: toha/list.html at ad837c364f8ea62ac70ad999afb15e637bcbab34 · hugo-toha/toha · GitHub to your layouts/index.html, it would work.

I really appreciate your help on this. Locally, when I use that index.html page, The image looks like this, by default. Not quite what I am looking for.

I have to click on “Introduction” then the “Post” in order for the page to look like this.

Are you sure your repo is correct as the link from the first post, I don’t see the index.html in it:

I put the index.html in the themes/toho/layout folder at first. Now, I also created a layouts folder from the root. Still no luck on my end.

Probably because your layouts folder is inside .github folder:

image (as shown in your IDE screenshot too).