Hi again!
Following your advice, I think I got it working exactly the way I wanted.
What I did:
- In my customized theme (to avoid modifying the original one), I moved
layouts/index.html
tolayouts/_default/hugo-profile-home.html
, like you said. - In
layouts/index.html
, I replaced its contents with those oflayouts/_default/list.html
. Then I replaced:
with{{ range .Paginator.Pages }}
So that it only picks up pages inside the{{ range (where .Site.RegularPages "Section" "blog") }}
/blog
folder. - In
/about/
, I created an emptyindex.md
file with the following parameter in its front matter:layout: hugo-profile-home
- I moved my previous
/blog/_index.md
file to the root of my site, so that it shows up above the list of blog posts just like before. - To avoid my posts being shown at
mysite.com/blog/name-of-post
, I simply added this to the front matter of every blog post:
I was already using theurl: "/name-of-post"
url
parameter to customize the URL of each post, so it was just a matter of removing/blog/
from them.
And that’s it!
The only thing left was to modify the actual navbar links in hugo.yaml
so that the “front page” sections now point to /about/section-name
instead of /section-name
, and do the opposite with the Blog
link (now pointing to /
instead of /blog
).
I was honestly not expecting it to be this easy, especially considering I have a multi-language setup where the English version of the site (and all the blog posts) are at the root, whereas the Spanish version is under /es/
. But I had already implemented proper handling and redirections when switching between languages, and because all paths are relative, everything worked automatically
Thanks again for your fast and accurate help @davidsneighbour!
I was missing the bit of knowledge where you can make any page look like the default home page by just turning it into a layout in layouts/_default/
, then referencing it by name in the front matter of any page. You nudged me in the right direction