Iβm following Hugo docs to create a quickstart website. It works until I want to apply another theme: hyde
.
I tried editing the config.toml
: theme = "hyde"
but the them doesnβt show, instead, the default βanankeβ is broken, no styles.
I tried using the command hugo -t hyde
but it doesnβt change anything.
Iβve also cloned a few more themes and follow their readme file but none of them work.
Any idea?
Have you installed the theme locally first?
git submodule add https://github.com/spf13/hyde.git themes/hyde
@plena, welcome to the forums. Please read Requesting Help and follow the advice so others can help you.
There are a million reasons your theme isnβt loading, but we canβt figure it out without either seeing the project, or guessing.
Your theme should be in the themes
directory, and the name should be the exact folder name of the theme. Do you have an online repo for your project you can share with us?
Yes, I have. Hereβs my folder structure:
βββ themes
βββ ananke
β ...
βββ hugo-travelify-theme
β ...
βββ hyde
βββ CHANGELOG.md
βββ LICENSE.md
βββ README.md
βββ archetypes
β βββ default.md
βββ images
β βββ screenshot.png
β βββ tn.png
βββ layouts
β βββ 404.html
β βββ _default
β β βββ baseof.html
β β βββ list.html
β β βββ single.html
β βββ index.html
β βββ partials
β βββ head.html
β βββ head_fonts.html
β βββ hook_head_end.html
β βββ sidebar.html
βββ static
β βββ apple-touch-icon-144-precomposed.png
β βββ css
β β βββ hyde.css
β β βββ poole.css
β β βββ print.css
β β βββ syntax.css
β βββ favicon.png
βββ theme.toml
Thank you for your reply. Iβll read it. My repo itβs just the default hugo quickstart
which you can find here and I cloned the themes using this command from Hugo docs:
cd themes
git clone https://github.com/spf13/hyde
And this is my repo structure:
βββ archetypes
β βββ default.md
βββ config-original.toml
βββ config.toml
βββ content
β βββ posts
β βββ my-first-post.md
βββ data
βββ layouts
βββ public
β βββ 404.html
β βββ categories
β β βββ index.html
β β βββ index.xml
β βββ dist
β β βββ css
β β β βββ app.e08a958ae3e530145318b6373195c765.css
β β βββ js
β β βββ app.3fc0f988d21662902933.js
β βββ images
β β βββ gohugo-default-sample-hero-image.jpg
β βββ index.html
β βββ index.xml
β βββ sitemap.xml
β βββ tags
β βββ index.html
β βββ index.xml
βββ resources
βββ static
βββ themes
@plena, I expect to see the output from your themes directory as shown above to show up in your project tree, under themes
.
I donβt have much else to contribute. That seems kinda odd.
It might be worth it to start the quick start over, fresh.
Thank you @maiki for the suggestion. I started fresh and it still doesnβt work. Hereβs what I did:
$ hugo version
Hugo Static Site Generator v0.49/extended darwin/amd64 BuildDate: unknown
$ hugo new site hugo-quick
Congratulations! Your new Hugo site is created in ...
$ cd hugo-quick/
$ git init
Initialized empty Git repository in ...
$ git submodule add https://github.com/budparr/gohugo-theme-ananke.git themes/ananke;\
> echo 'theme = "ananke"' >> config.toml
Cloning into ...
...
Resolving deltas: 100% (600/600), done.
$ hugo new posts/my-first-post.md
<path>/hugo-quick/content/posts/my-first-post.md created
$ hugo server -D
...
$ cd themes/
$ git clone https://github.com/spf13/hyde
Cloning into 'hyde'...
$ cd ..
$ hugo -t hyde
$ hugo server -t hyde
And it broke them ananke, no post (see below). It does not look anything like theme hyde here
hugo -D
builds drafts. Try hugo server -D -t hyde
.
Thank you. It does show up the post, but the theme doesnβt apply. Itβs still ananke.
I followed your command line entries and am able to switch to either theme using the hugo --theme switch or by editing config.toml. I believe the config.toml theme configuration takes precedence. To be sure when testing I would use only one or the other method. Also be aware of any possible browser caching.
Sorry @plena, I canβt reproduce your issue. As mojoa points out, beware of browser caching. Maybe try on another computer.
It should not be necessary but, try deleting ananke from your theme folder if you wonβt be using it. Make sure no other copies of hugo server
are running, before starting it again with your preferred theme. Also, caching does sometimes cause trouble so, what I do is use a plugin for easily clearing the cache in Firefox or Chrome, that I can click to perform the cache clear. Also sometimes closing and re-opening the tab on the browser helps.
Thanks everyone for your help.
FYI: Iβve tried 2 different computers, cleared cache, used different web browsers, none works.
The only thing that works is removing ananke
from /themes
.
This is odd, given the fact that some of you are able to switch between themes.