Index.html is not being rendered

Hello,

my project is divided in three parts:

  • main project (overall configuration, importing other modules via .work file)
  • theme: the actual theme, respective module imports
  • content: the content

The overall setup works, but there is one issue I am a bit stuck: it does not generate a index.html. With another theme it works, so should be an issue with it.

Theme layouts:

layouts
---- _default
-------- baseof.html
-------- list.html
-------- single.html
---- partials
-------- footer.html
-------- head.html
-------- header.html
---- 404.html
---- index.html

404.html:

{{ define "main" }}
    <h1 class="text-3xl text-blue-700 font-bold underline">not found :(</h1>
{{ end }}

index.html:

{{ define "main" }}
    <h1 class="text-3xl text-blue-700 font-bold underline">I am a new site!</h1>
{{ end }}

The strange thing is: the 404 page is being rendered, but there is no output for the index.html. Do you have any ideas, what could be the reason for that?

Thank you!

Edit: Dummy Git Repo: GitHub - Sapp00/hugo_dummy

You are more likely to receive a prompt and accurate response if you post a link to your project’s Git repository.

See Requesting Help.

Let us see your code

Include a link to the source code repository of your project, because we really need the context of seeing your templates and partials to be able to help you. It is trivial to do a quick git clone on your repo, then run hugo server in your project, to help you out. On the other hand, recreating your code from screenshots, or sort of guessing at it, is not.

If you can’t share your repository for whatever reason, consider creating a dummy repo that you can share, which reproduces the problem you’re experiencing.

Thank you, added a Git repo to reproduce the issue.

This is what I did:

npm install -g pnpm
git clone --recurse-submodules https://github.com/Sapp00/hugo_dummy
cd hugo_dummy
pnpm run setup
pnpm run dev

And when I look in main/public I see that an index.html was not created in the root of the public directory.

main/config/_default/config.toml

[outputs]
home = ["SearchIndex"]

The above tells Hugo to render the SearchIndex output format, and nothing else, for the home page.

At a minimum I think you want to do this:

[outputs]
home = ["html","SearchIndex"]

Or maybe this:

[outputs]
home = ["html","rss","SearchIndex"]
1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.