Organisation and Configuration for two static sites in the same folder

Do you mean a “two-site-setting”?

Yes, this was a short look to my native language :wink: I meant two-site-setting of course.

You mean, its a more simple way to do it like this:

Is this what you mean?

Not exactly. You’ve got two options:

  1. Create two different sites in two different folders and merge (maybe by specifying the publishdir in the correct way for one or both of your sites) the output.
  2. Use the section1 section2 method and write different layouts for them and create just one site.

The structure of folders you suggested in your first post in this thread - I don’t believe that this will work without problems. You’ve got nested folders but two completely separated sites in it, sounds strange for me.

Just play around for while with very simple layouts, just some kind of a “hello world” and find out what fits best to your needs.

The main reason for originally wanting to use two separate sites is that Section2 is going to get updated regularly whilst the rest of the site is going to rarely be changed. Is this a good enough reason to use separate sites, or is the more a job for Git Subtree?? Im thinking mainly in relation to rebuilding the site every time a change in Section2 occurs, would there be little disadvantage to just use a single site and just rebuilding the site again every time there is an update/change??

I’ve never used git, so I’m not the one to answer this.

But the build time for Hugo is so short, I wouldn’t get the idea to split my site, there is just no reason for it.

And it’s been discussed before some times, one of the next versions of Hugo will maybe be able to create just the changed parts and not build the complete site again and again.

So, it depends. How big is your site?

Generally speaking, Hugo is surprisingly fast, so I would recommend building a single site to start with. Don’t over-complicate this thing before you even get started.

1 Like

Assuming that I have chosen the single site option, I have two different themes, can you explain how I should organise the Source directory.

I dont know whether both themes should go together in the Themes folder, or whether they should be put in the Static and Layouts folder, with both themes’ Static files going in the Static folder, and both themes’ HTML files going in the Layouts folder.

Choosing a single site option means you have one theme. Hugo is not able to use two different themes in one site.

Read the docs about creating a theme and use the file structure given in my first reply. You can use different stylesheets in different layouts and you may save them in a static folder.

Look around at the themes showcase and the linked repositories to get a feeling for organizing your source.

Ok this clears up that confusion.

Yes, thats what I was using as my guide. What is throwing me off is that your file structure uses a “themes” folder which in turn has “layouts” subfolder (and presumably static folder?). My question is should I put the static folder and layouts folder in the themes folder or should they be in the root folder (which I think is the conventional structure)??

Okay, now I see. I developed my own theme separate (to get it maybe sometimes on git for others) and haven’t written it.

Also there is a mistake in it, all “themes”-folders have to be corrected to themes/YOURTHEMENAME/..., sorry for that.

Right… but what should be below themes/YOURTHEMENAME/... if there is a Layouts and Static folder in root??

Read this to check which template file is processed when using a theme in themes and providing additional files in your root

Thank you for this, this sets me in the right direction, but at no point does Hugo Docs explain what the difference between

/layouts/
/themes/layouts

Its says if one folder is empty it then uses the next one in priority. It doesnt say when to use one over the other, or the advantages of using one over the other, just like if you have TWO themes with two different static folders and two different html, where to actually put this, or where you could or should put this.

This whole entire thread exists because Hugo Docs simply doesnt explain properly how to actually use Hugo.

I would:

  • Have to Hugo sites
  • Have the first build to /public
  • Have the second build to /public/second (or whatever)
1 Like

I appreciate your input, but this goes against two peoples suggestions, that now span 20 odd posts, across two threads.

I really dont know what I should do…

My approach is just a variation of what I see mentioned above, but the benefit is that it gives you a complete folder ready to be copied to your server.

The above have suggested a single site, you have suggested two sites. Is this not correct?

The above suggests both … If two sites, I would build into the two folders I mentioned.

What about the issue with sitemaps?

Would I organise the local root the way it has been done in this post??:

…or would it not matter??