I'm using the Stack theme and I'd like to move the homepage which by default is an overview of blogposts to a subordinate page called "Posts". And the landing page that appears when first launching the site should be one of my choosing.
How do I do this?
I've tried several things, for example switching the contents of _index.md
at the base of /contents
with the page I'd like to replace it with.
But I'm guessing there's some script magic going on in the background, since all that's in _index.md
is this:
---
menu:
main:
name: Home
weight: -100
params:
icon: home
---
so I don't know what's telling the page to display the posts.
I've also looked in layouts/partials
of the theme, but I can't find anything applicable.
I've seen redirecting but if I'm understanding that correctly, I'd prefer another way, as I'd love the base url example.org
to be the custom page, and not automatically being redirected to example.org/my-page
Any pointers?
Thanks!
Would you like the new landing page (home page) to be completely custom?
If so, then you can create a file in the root of your site's layout directory called _index.html. This will override the theme's landing page.
However, if you want a variation of the existing landing page then you'll have to use the existing one as a template, and alter it how you wish.
How are you using the theme?
If it's with Git Submodules then the _index.html file will be in the themes/layout directory. Copy it to the root of your own layout directory to override the theme's.
If you are using the theme through Hugo Modules then you can either find the files online and download them (if they're available on Git*) OR run hugo mod vendor
with the Hugo CLI tool. This will download a local copy of the theme into a directory '_vendor' of your site's directory. Copy the _index.html file in _vendor/layouts to ./layouts. The _vendor directory is now where your theme is being loaded from, so if you want to update it or change it you need to do so with the CLI tool.