How to get started with templates the correct way?

I’m starting off with Hugo and am stuck how to use templates properly. In the instructions they have used the Ananke theme and have installed it as a sub module:

git submodule add themes/ananke

I thought I’m going to use Vex: to try out a different theme.

hugo new site my-web
cd my-web
git init
git submodule add themes/vex
echo 'theme = "vex"' >> config.toml
hugo new posts/
hugo server -D

The result doesn’t even look remotely like something to get started off. Why is the post not showing anywhere?

Have I missed anything? Should I instead clone the exampleSite and work off that instead?

cd vex-hugo/exampleSite/
hugo server --themesDir ../..

I was expecting a standard approach to this, so I wonder if I’m missing anything.

Hey! So, I’m not sure that this is the issue you’re running into, but themes are able to choose which content types they work with and which ones they don’t. For example,

  • the Ananke theme by default works with types named ‘post’ and ‘page’
  • the Vex theme looks like it works with types named ‘product’ (or maybe ‘products’).

I got a feel for this by reading the theme source – looking at the example sites supplied is another great way to figure it out though, as is checking the documentation for the theme (though, Vex doesn’t make any mention of this).

This is one of the disadvantages of Hugo being so flexible – there’s no “standard types” per se, but many themes work on the convention that there’s a type named ‘post’.

Depending on your content, you might be able to replace hugo new posts/ with hugo new products/ and expect everything to work.

Thank you, that explains it perfectly.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.