How to get hugo to serve an HTML page from /static/

#1

Hello,

I have a bunch of old web pages that are too time-consuming to reformat for a huge site and are only there to serve as archival stuff for anyone who wants to revisit them.

I have been trying to get Hugo to sure the files directly from the static folder but all I get are “404 file not found” instead of the intended file.

Is there any way of forcing Hugo to serve an HTML file like it would any other type of file in the static folder?

Thank You
Matthew Morgan

#2

Hi there, from what I know about hugo (after learning it for few weeks from scratch! LOL), everything you put into the static folder will be copied “as it” to the public folder (where you can upload to your server) and you can link to them directly.

e.g. a html in static folder:
static/yourpage.html

when you hugo it in your cmd, you will get the file at:

public/yourpage.html

if you there is a folder, then you have to access it on that specific folder. the ‘Static’ folder in hugo is just a place to store something, when it’s ready for upload, it will disappear. we have to link it directly without the “static” in the path/url.

please correct me if I’m wrong :slight_smile:

I really like Hugo, but currently I have tons of confusion with their structure calling or params something. LOL but it’s really fun.

cheers!

#3

Thank You
After doing more testing, it works perfectly after exporting the files but it is the Hugo Server software that fails to serve the files.

#4

Hi,

I’m not sure I understand what exactly you mean by

If you are able to share your site code, that would make it easier for us to help. We don’t need the whole project if you are unable to share that, but at least some dummy code that demonstrates what is not working.

#5

Please read Requesting Help and share your code. We can’t assist you as it is, we need to know what you are doing. :slight_smile: