There’ a few things (you probably know some of them already).
as @RickCogley said, you need to download the themes from github. How
to do that is in the documentation in ‘installing themes’ (post again
if that process isn;t clear).
when you use a theme it does not create a theme folder in ‘public’,
it just uses the theme to build the site with that layout
you can run “hugo --theme=hyde --buildDrafts” (without server) to
just build the public folder to run in your own webserver
also the Hugo command you are using assumes the downloaded themes are in your project folder. I change this to put all the themes in my main hugo folder 'so I put 'theme="…/themes/THEMENAME" in my config so i don’t need it in the build command.
I downloaded the theme. That’s why when I run hugo server. I can see the hugo blog with theme. But when I launch Index.html from public folder, I don’t see the theme. I will try what @mikeaja suggested. Thanks!
Hi @mikeaja I tried runing ““hugo --theme=hyde --buildDrafts””. but when I double-click on “public/index.html” then I don’t see the blog with theme. Yes. I have themes downloaded under theme folder. Do I need to manually edit the “public/index.html” to link with theme?
There are very likely others with more experience than me who can help better.
I don’t understand this part. What is there will be the result of what is used from the theme, what is in your project’s ‘layouts’ folder, how that connects with the sections your content is in, and perhaps what is in your contents front matter (if you’ve specified any ‘Type’ for the content, which is not necesary)…
What’s in Public is what’s generated, so you don’t want to change anything there.
The double click part doesn’t work out of the box … This has to do with the reference to external resources (stylesheets etc.). You need to run it on a server (or use relativeURLS=true should also work… but that is outside scope of this question).
I don’t change anything. I followed quickstart to create the site and post. and downloaded the theme. I tested the site by running the server. It works well…
But I don’t want to run the server since my host already have IIS. All I want is the static site. The idea is that to write the post in my laptop and commit the change to my git repository (I will put everything under public folder to the git repo). And then I will upload those js,css, image and html files to CDN or Azure Blog storage. The problem now is that I need to run the hogo server to make my blog working. I don’t understand why hugo has such a requirement. I just look for static blog generator or engine. not a web server.
Not sure if I’m missing something here. Hugo creates static sites. You could develop and build sites with Hugo without ever having to use the ‘server’. It is there just to make life simpler for local developing and making changes, not as a hosting server.
It’s working fine. 2 pages are created and I am able to see my blog with two pages and theme via http://localhost:1313.
The problem or the confusion started here.
I wanted to upload that ‘public’ folder to my web server via FTP. So, I stopped the hugo server by pressing control + C and exit the commandline.
And then I double click on mysite\public\index.html. When the html page showed up on browser, there is no theme. So, if I upload the ‘public’ folder only to my web server that doesn’t have go installed, it won’t work.
As I am a new user, I have no permission to upload the screenshot.
I tried create a virtual directory (website) in IIS on my local machine and point that site to mysite\public\ folder. When I access that site from Chrome, I got the same result (naked HTML page without a theme).
What do I need to upload if i want to host my static site generated by hugo on my web server? Uploading the ‘public’ folder is not good enough.
That’s not how the web works. Double clicking on it is not running it in any local server so it’s not a good test of what will after upload. (This is why there local servers are used in development).
If you see the site correctly with Hugo server, then Hugo has done it’s job. It means the site is being correctly built in Public (and running Hugo without ‘server’ builds it for production use - see docs). The rest is outside the scope of Hugo.
Virtual directories on IIS are there to create separated application spaces for when you need more than one app (dll) on the server. This is nothing to do wiith static sites.
My advice is (and I hope this does not sound bad or patronising, it’s not my intention) take a crash course in how HTML (and connected files) are served on the web and IIS. Bear in mind, most online info and tutorials will be assuming you are using a Linux / Apache server, so you need to translate that stuff to what it means for IIS (for example, htaccess).
Yes and No. IIS can definitely serve the HTML page (static site). The static site (html) can be served on any web server (IIS, Apache, nginx and etc.) .
Of course, IIS supports .NET 2.0 or .NET 4.0 by default. You can run classic asp with ISAPI extension or run php with php extension. but it doesn’t mean that you can’t host the static site (html + js + css) on IIS.
I saw some people are using CI/CD (Continuous integration/Continuous delivery). I haven’t tested them yet because uploading the generated folder should be enough. Thanks for the advice. I will find that doc and will play around.
There isn’t any yes and no. What I wrote is what virtual direcctories are designed for :)… I think you missed my point. You said you’d set up virtual directories to solve the issue, but these are not relevant to static sites working on IIS (being able to use IIS for static sites was not in question).
I had a very similar problem but the prototype I am working with does not use hugo themes; it is nano theme/asset in static. it rendered fine with hugo server but not when generating output to public. adding relativeURLS=true to config_en.toml worked.