Tree structure for testing themes?

Have been able to install a few themes, then deploy and upload to a site to test the look/feel. I’m amazed at how quickly and easily HUGO does all this.

Yet I think I have got myself in a bit of a mess, in a directory or tree structure aspect. As it has only been a few days it will be best to delete it all and start again. Some questions please.

  1. To start again, does one simply delete the path where the blog/content is, or are there library considerations to allow for ?

  2. How do you manage various themes ? Do you download by zip or use GIT into a path seperate from where the blog/content is, then copy into the blog path ?

  3. Of the “how to’s” that I read, there was an assumption that a user knew what they were doing, and that is not always the case for a (hugo) newbie. Of what I did read, one assumption was that the user knew what path they should be in. This was reinforced by the omission of the “cd” command in many cases, if not all cases. So, my other request for help is to be shown what path one should go to, to perform various functions/tasks.

(Documentation is usually written by those who have walked the ‘path’, pun intended)

Yet I must say, after a week or so of using another major static site builder, that HUGO is very easy to use and work with.

Hello there,

Some general points:

  • For most (good) themes, you shouldn’t need to make major changes to your content to be able to use them. Some might require frontmatter variables to be in place in certain content, and some might need you to configure them in a theme-specific way.

Personally, I like managing my Hugo dependencies (including themes) using Hugo Modules. This is a good summary: How to add a theme using modules (for beginners)

I have also used git submodules, and I have also git clone-d themes. There are many ways to do this.

I would recommend reading this page thoroughly: Directory Structure | Hugo

Generally speaking, most Hugo sites will follow this standard directory layout; content goes in /content/, themes go into /themes/, etc. When we talk about running hugo commands, this generally means running hugo, hugo server, etc in the root of your Hugo project. Usually this means the directory that contains your config.toml file.

Now, we don’t know where in your filesystem you put your Hugo projects in. So we won’t put in the docs to "cd into /Users/bob/2021/projects/funny/hugo/testing/project-one/final-final-2/.

Finally, it is much easier to get help here when you have a specific question, and when we can replicate your situation. Have a read about Requesting Help

Have a browse through some of our Recommended Reading Reference as well: Recommended Reading Reference


@pointyfar - Thanks for your reply, that is great. It will take me a day or so to read/understand the documentation from those links. As you can see from this screendump, mostly the issue/s I had are with navigation. Some themes went in a logical path, others not so. That link you supplied on the directory structure will help for sure, thanks.

If you have time to check, I have a repo with my own theme tester. If you are using a Linux with Bash then have a look. If not, have a look anyway and transfer to your own local scripting engine:

The files in bin do the stuff. The files in etc define what theme to load. All is more or less git based and you choose when running the system which theme to install.

It wasn’t updated a while, but I recently used it locally :wink: By the way, don’t use the included configuration. That will fill up your harddrive with millions of files. Just add the themerepos for the themes you want to use.

This works on most themes (95%). Some have weird configurations and need manual fixes to their example site. If there is no example site within the theme it won’t work.

1 Like

Where you put your themes in your filesystem is under your control. If you download your themes into /Downloads/, Hugo wouldn’t know about it. It is up to you to manage where theme files go, and to make sure they go in the right place.

Perhaps a refresher on git commands will be helpful as well, if you are getting your themes via git clone or git submodule as this informs where your files end up in your filesystem. This is outside the scope of the Hugo forums.

1 Like

@pointyfar and @davidsneighbour thanks for your replies. I hope to get back to this thread soon, we had heavy storms, no power, no internet, no mobile, so it feels like I’ve been a caveman for a few days …lol

As @pointyfar stated, where we put themes is totally under our control. It was simply a navigation issue for me. This bash script works for me …

cd ~/Hugo

hugo new site mysite

git init

cd mysite/

# add themes
git submodule add themes/hugo-scroll
git submodule add themes/parsa-hugo

So any new themes to be tested can be added by git , as long as the current path is

 `cd ~/Hugo

The tree structure is shown in the screendump.

It’s easy to add a theme via .git, however if I need to remove a theme via .git, …hmm, …not so easy it seems ??

Lots of different methods and degrees of complexities at git - How do I remove a submodule? - Stack Overflow . Although this approach at Git - Removing a submodule | git Tutorial looks a lot easier.

For now I’ll just ignore the ones that don’t work.