Single page without content part


I want to create a single static page for my custom theme. I do not need this to handle any content, so I would prefer to not do this through a single item page and prefer not to depend on any dummy file in the contents dir.

Why would I need this? This page will be a search result page, which doesn’t need any generated content, just a place where it can show the results through some js magic.

Is this possible?

You could add your page under the static dir

1 Like

I thought that is only for assets liek css or js.
Thx, I will try it!

Hm, this works, but I may have missed some part. While I don’t need any dynamic content, I would prefer to use the theme’s templates already set up, so I can render my content in the “main” block and reusing the wrapper code already set up.

Not sure if this is possible through the static folder but it looks like to me the files there are as-is without any go template features.

Well, why don’t you want the file to be under the content dir?

It feels a bit out of place to me, as it would indicate that this should be changed by a content editor, while that’s not the case. Changing that file at best would do nothing, at worst will break functionality.

Regardless of this, I’m not sure if this is the “Hugo way” and if I try to accomplish something that goes against the central logic of Hugo, or I’m just missing something basic.

Seems fine to me. If this site is edited by others, you could give explicit notes in the docs of what not to do

1 Like

How about adding a new content type, and editing the list template to be your search page.

1 Like

This too seems like a good idea, as a list template doesn’t need to show any content of that type. This would work I think.

Thx for the insight for both of you!