Search code examples
hugohugo-content-organization

I want to show the blog posts on home page in hugo using .toml file


I am trying to build a blog website using hugo. Everything is going all right on my site except for showing the blog list on the homepage. I want to show all blogs on the homepage but my theme is not doing it automatically. I am using Mediumish theme. In this theme, if I add any content in the config.toml it will show in the homepage. There are some text contents on the homepage. Now, I want to replace them with blog list. How Can I do that?

Thanks in advance!

N.B: currently the blogs are showing in the cold-email-bootcamp slug - https://splendid-pavlova-fbf620.netlify.app/cold-email-bootcamp/

Code Link: https://github.com/shawon111/hugo-sharable live website link: https://splendid-pavlova-fbf620.netlify.app/


Solution

  • No clue how the theme was set-up, but if you want to show all content on your homepage

    in index.html:

    {{ range .Site.Pages }} 
    {{ .Content }} 
    {{ end }} 
    

    You'll probably want to:

    {{ range .Site.Pages }} 
    <article> 
    <h4>{{ .Title }}</h4> 
    <p>{{ .Summary }}</p> 
    <a href="{{ .Permalink }}">Read more</a> 
    </article> 
    {{ end }}