HUGO

Two home pages

Hello

In my theme, I want to create a second add-on page with a feed of posts, in which posts will be sorted by update date, or any other parameter. Can this be done somehow?

There can only be one home page at the root of your site, unless you made the site dynamic (i.e. non-Hugo) and changed it depending on certain conditions, like the presence of particular data in a cookie.

You can add other pages that will give different ‘views’ on your content. Add a page called date.md and add layout: "datesort" to the frontmatter (if you are using YAML). Then create a datesort.html layout template in the layout folder that sorts according to how you want it to be sorted. That’s the hard part.

Then add a link from your home page to this page.

Hello

Thanks for the advice, but I didn’t fully understand what needs to be done ((

I created a folder called ‘better’ in the ‘content’ folder and put index.md in it. It indicated: layout: “better”.

In the template itself, I added a better folder to the layouts folder and index.html to it.

But nothing worked. Yes, the page / better appeared, but there is a wrong template

The template under layouts/better/index.html is meant for a Section list page.

Yet you have /content/better/index.md which is a Single Page controlled by /layouts/better/single.html

You need to either rename the template to single.html or if /better/ is meant to list more content files you need to change the index.md to _index.md so that you get a published Section and not a Single Page.

See the template lookup order for Page Kinds:

I renamed index.md to _index.md and in the end it didn’t help. Yes, the template has changed. Layouts / _default / section.html is now used instead of single, but not layouts / better / index.html

We cannot know what is your setup without seeing the full context.

See the Requesting Help guidelines and provide a minimal repo that reproduces your issue.

However I am terribly busy at the moment and I’ve no time for support in this forum.

Perhaps someone else can look into it, if you provide a repo.