How to make index.html include content from content/

Hi, another question:
How can I configure Hugo to include content into the generated public/index.html from a md file in /content - like e.g. from
content/ ?

The actual filename in the content/ dir could be anything else, but then it should not trigger generation of any other file, I only want the content to be generated in public/index.html.

This is for a very simple site structure that does not need any generated list of posts on the public/index.html - there are a few other top level pages that I currently generate from

Currently I am generating these with the uglyURLs = true setting - however, does not work as expected.

How to do this?


Put the content in a data file. Then just point your template to data.indexcontent.yml (or toml, etc). Also. You can put whatever you want in layouts/index.html using good old-fashioned HTML.

thank you for your quick reply.
hmm, the data file approach seems too hacky in this case, just using index.html in lauyouts seems better.
Just to explain: I would like to enable non-technical users to create content easy, so I would like to avoid any editing of html or any “hacky” solution. Just editing md files seems ok until you come to that special handling of the index.html file by hugo.

I do not understand why I just can not have a simple file in the content folder - this is a limitation that does not make sense. All the auto-generation features for an index.html page could be preserved, from what I understand.

What is more problematic is that the content editing logic is broken here - no non-technical user will ever understand why he just can not edit the most important file of the website, - “well, it generates stuff” will noty be a good answer, he will say “just generate that stuff anyway or optionally, but please let me edit my homepage!”

Just to explain the usecase a little bit.

Maybe any other solution to this? How can I allow to edit the homepage?


ah, ok I now just found
Looks like this is a known limitation of Hugo that I ran into. hopefully there will be a solution for this problem in one of the next releases. :slightly_smiling:

The workaround(s) are fairly straight forward.

Just experimenting with the workaround from that github issue and trying to understand if it will have any negative side effects. It would feel better if Hugo supported such a default use case out of the box without any workarounds and without having to search two hours for it. One single sentence in the documentation would be helpful, too. Otherwise, ok, hopefully that step-1 problem is solved now. Still like Hugo, but that was annoying.

Thanks however for your help!

This is an open source project, so the quality of code and documentation is a collective responsibility. Please contribute improvements.