[SOLVED] New Theme Not Rendering

#1

I’m brand new to Hugo and would like to get a new theme off the ground. But none of the changes I make to the theme files seem to render. In fact, nothing seems to render at all. I created a new project:

hugo new site test

and created a new theme:

cd themes
hugo new theme test

My config.toml looks like

baseURL = "http://example.org/"
languageCode = "en-us"
title = "My New Hugo Site"
theme = "test"

And now my directory structure looks like this:

├── archetypes
│   └── default.md
├── config.toml
├── content
├── data
├── layouts
├── public
│   ├── categories
│   │   └── index.xml
│   ├── index.xml
│   ├── sitemap.xml
│   └── tags
│       └── index.xml
├── resources
├── static
└── themes
    └── test
        ├── LICENSE
        ├── archetypes
        │   └── default.md
        ├── layouts
        │   ├── 404.html
        │   ├── _default
        │   │   ├── baseof.html
        │   │   ├── list.html
        │   │   └── single.html
        │   ├── index.html
        │   └── partials
        │       ├── footer.html
        │       ├── head.html
        │       └── header.html
        ├── static
        │   ├── css
        │   └── js
        └── theme.toml

I made some changes to the head and header partial (added a head and title, and a “Hello, world!”, respectively) but they don’t show when I use hugo server. I’ve also edited the baseof.html with the same info the same thing happens. I’ve downloaded the Ananke theme and that shows up even with no content to the site, though sometimes it persists even if I shut down the server, delete the ananke theme and change the config.toml, and restart the server.

Has anyone got a clue as to what I’m doing wrong?

#2

I’m pretty sure the test theme is very bare. It gives you the necessary files but they’re empty.

To get started, put some valid HTML in themes/test/layouts/index.html and run hugo server, and you should see the output at localhost:1313.

Though I wonder if you’d be better off working from a theme—there’s loads to choose from.

#3

Thanks for the reply @funkydan2, I am able to see changes made to my themes/test/layouts/index.html, but I am still scratching my head as to why the changes made to my themes/test/layouts/_default/baseof.html aren’t showing up, nor are my changes to the partials. Do you have any idea why that might be the case?

#4

I’ve got a few ideas of what you may be doing wrong, but without seeing your code it’s impossible to know.

Probably best to commit what you’ve got to a git repository and then we can see what you’re attempting.

https://discourse.gohugo.io/t/requesting-help/9132

#5

Thanks again @funkydan2. Here is the github repo.

#6

Keep working on it. Don’t let up. We look forward to your theme. You don’t need to settle on someone else’s. Just be ready to put in the time to learn.

#8

So in your baseof.html you’ve got a call to a block called main. Where is that block defined?

1 Like
#9

Thanks @funkydan2, I defined main in index.html and the rest of my changes to head.html and header.html are showing up!

#10

Good to hear.