Where to add the function latest posts?

Hi Hugo Users,

Iam an absoluetly new beginner in using hugo.

My job is to renew our teams webpage. Step by step I m going to ad functionalities…

I would like to add a sidebar function where the last 3 posts are visible at the main page.

In which folder this has to be put and how does it look like?

Thanks in advance

Greetings from Hamburg

Checkout the first function

Edit: also checkout the docs on using where with first

It would depend on what your site layout looks like

Thank you zwbetz.
I’m using the theme mainroad https://github.com/Vimux/mainroad

One option is to override the recent.html partial

super, I will try that solution. Thank you.

unfortunately it is not working :frowning: my page looks like above

We need some more info to be able to help you, so please have a look at Requesting Help and provide some more details, like a repo for your site? Thanks.

It appears that the config.toml for that theme has a lot of options like where the sidebar is supposed to go and so on. Have you tried tweaking those settings?

From your screenshot it looks like your sidebar is not showing up at all. But in the theme’s screenshots on its page, the theme does have a sidebar so I think it might be settings…

1 Like

Thank you for your answer RickCogley. But where can I adjust the settings?

It appears the theme is set up to take its settings from your config.toml, per its readme. If you haven’t already you should copy those settings into your own config.toml.

If you give us a link to your repo, say on Github, we can help better.

I have the repo locally on my pc. But you are right, it’s a good idea to load the repo on github. I will try to do that.