Changing Theme of One-Click Hugo Install on Netlify CMS

Hello, Hugo People:

  1. I am a static-site generator newbie with a free Netlify CMS hosted site running Hugo through their one-click installation which seems to be their customization of a boilerplate/framework/starter-kit called Victor Hugo

  2. The default theme provided with this installation is Kaldi but I would like to change it

  3. Unfortunately, Victor Hugo is different than “plain” Hugo so the regular theme changing instructions for Hugo don’t apply to Victor Hugo – namely, there is no “themes” folder in Victor Hugo

  4. After four hours now of researching, I’ve finally been told to simply create my own “themes” folder in my Netlify CMS one-click install of (Victor) Hugo and, presumably, carry on following regular instructions for changing Hugo themes – namely, edit config.toml and point it to my preferred theme

  5. Unfortunately, this isn’t working; Netlify CMS and/or Victor Hugo seems to be pulling information from somewhere else other than the “themes” folder and/or config.toml file – I still see the default Kaldi theme

So does anyone know how I can change the theme here? I’m totally flummoxed.

My Hugo site’s repo is at https://github.com/daveydaves/one-click-hugo-cms – I’ve thoroughly checked for typos and the like so thanks for any insight!

I should note, FWIW, that I’ve changed my Netlify CMS-website’s URL from its nonsensical Netlify CMS-assigned default…I doubt this is the issue but I’m raising it in case it’s actually a factor somehow. Thanks again.

I think the “theme” being used by your site is set in two places

  1. site/layouts/(for all the html)
  2. src/css and src/js

Because of the way hugo works, anything in the layouts directory overrides anything in the theme directory. So the first step would be to delete everything under layouts, and then look into the way the css and javascript are being compiled/built by gulpfile.babel.js. And since you’re hosting on Netlify - make sure you install the theme as a git submodule

(Since I’m not familiar with modern javascript development, I was better off not using the victor-hugo install, and just followed the docs.)

2 Likes

Well, that’s certainly news to me! Thanks for the tip…didn’t seem that way from my research but that’s the thing with trying to piece together, Frankenstein’s Monster-like, different advice from different situations ('cause apparently no one’s ever been confused on this issue like me in the whole history of Hugo!!)…

Sigh – it’s like an old Infocom game, where to accomplish Task One, there’s first Task Zero to be done, which depends on Task Negative One being completed…

Thanks again, though; every little bit helps. :slight_smile:

You’re welcome. There’s a bit of a learning curve to get started with hugo, but once you get your head around a few things, it’s fairly easy.

For me, I didn’t go the victor-hugo route, as it seems to add a lot of complexity with builds that I’m not familiar with (all that gulp and babel stuff). So I recommend just using the basic hugo install, and follow the tutorial I linked in the previous post for hosting on netlify.

For directory structure, have a read of

Yeah, tell me about it: Netlify CMS really screwed the pooch making their one-click install of Hugo seem all innocuous! Changing themes is like the second or third thing many a new user would think of, probably, so to straight-jacket people like this without warning seems like digital malpractice! :slight_smile:

BTW, I’ve followed your previous links and looks like I need to install Git Bash for Windows (did I mention that I’m a Git newbie, too??)…so I’ve done that but it seems like I need to point Git Bash to my repo online, correct? So how do that do that, please?

Right now, I’m getting

David@DESKTOP-F9RT0A8 MINGW64 ~
$

So how do I get this thing pointed at my GitHub repo with the Netlify CMS Hugo site so that I can proceed following the instructions about setting up submodules and whatnot? I’m currently googling to no avail so I thought I’d ask…

Thanks!

I’m not familiar with the windows git bash, but your first step will be to clone the repository:
git clone https://github.com/daveydaves/one-click-hugo-cms.git
And to install hugo for windows

Thanks again, man – I’m gonna see if I can “salvage” the one-click install before I just do the “traditional” route…I’m stubborn like that 'cause I guess I’m an optimist, for all my grumbling!

Besides, it’d make for a great first blog post I think…like I’d said, there’s no tips anywhere online about this at all (changing the theme of Netflix CMS’ one-click Hugo install), can ya believe that!

Did you ever get it figured out? I’m struggling with the same thing. This really shouldn’t be so hard.

Hey,

So sorry but no; Netlify CMS didn’t want to provide support unless I paid for a subscription – otherwise it’s free and provided as-is.

I agree that it shouldn’t be this tough to make a common simple change!

To echo @funkydan2’s comments, the point of using Victor Hugo is to take advantage of the other tools that come bundled with it, e.g. Gulp, Webpack, PostCSS, Babel, etc.

To me, it is geared more towards creating a custom layout, instead of used an official theme. But, using a theme can still be done. OS-specific steps follow.

In a nutshell, the src dir, which holds all the bundled CSS/JS is deleted. Then the site/layouts dir is deleted, so that it doesn’t override the theme layouts. I then shamelessly add my own theme and use its example site. The npm install is still necessary since it actually downloads the hugo binary for your OS – note that the version it downloads, v0.49.2, is outdated.

Windows

  1. git clone https://github.com/netlify-templates/victor-hugo.git
  2. rmdir /s/q src
  3. cd victor-hugo\site
  4. rmdir /s/q layouts
  5. git submodule add https://github.com/zwbetz-gh/minimal-bootstrap-hugo-theme.git themes/minimal-bootstrap-hugo-theme
  6. xcopy /s/y themes\minimal-bootstrap-hugo-theme\exampleSite\* .
  7. cd ..
  8. npm install
  9. ..\node_modules\hugo-bin\vendor\hugo.exe server

Mac/Linux

  1. git clone https://github.com/netlify-templates/victor-hugo.git
  2. rm -rf src
  3. cd victor-hugo/site
  4. rm -rf layouts
  5. git submodule add https://github.com/zwbetz-gh/minimal-bootstrap-hugo-theme.git themes/minimal-bootstrap-hugo-theme
  6. cp -R themes/minimal-bootstrap-hugo-theme/exampleSite/* .
  7. cd ..
  8. npm install
  9. ../node_modules/hugo-bin/vendor/hugo server
1 Like

@daveydaves After spending days fighting with Netlify CMS, I gave up and just installed Hugo locally. It took maybe an hour to set it up, customize a theme, migrate all my content from WordPress, and deploy to Netlify. It’s amazing how much harder Netlify CMS made things.

1 Like

Yeah, I gave up too – but completely; I’ll revisit it all one day I expect but for now I’ve got other things to tinker with!

I only wish I understood why Netlify made the decision they did to not only use Victor on top of Hugo but to customize Victor as well, such that Victor’s normal theme customizations don’t work on Netlify’s implementation of Victor!!

BTW, I’m glad you got it working in the end! Gives me hope, 'cause I was afraid that doing it the old-fashioned local way would wind up being all convoluted somehow, too!

Thanks, Zach – but why did Netlify break Victor’s normal theme customization capabilities?? That’s what I don’t get. I can’t just follow “vanilla” Victor’s instructions on customizing themes, it seems. Or do those bundled tools necessarily mess with that? Sorry, this kind of tinkering is all new to me.

I’m gonna try going through your helpful notes. Thanks again, Zach!

Well – and this is just me speculating – I don’t think victor-hugo is geared towards novice users. It “bundles” Hugo with additional build tools (Gulp, Webpack, etc.), and then it’s on you to build a custom layout from there.

For most users, downloading the Hugo binary, reading the docs, and a little knowledge of HTML/CSS is all that’s required to get things rolling.

Unless you need the additional build tools that victor-hugo offers – and they obviously have their place – I think you are better off without them.

Good luck :+1:

Yes, I see it’s not for newbies now – but really on account of the lack of documentation; there’s nothing inherently hard about it like trying to come up with an algorithm or something like that!

Thanks again for all your thoughts, Zachary.

For me, it seems easier and more flexible to create a Hugo site the usual way, i.e. without using Netlify’s One-Click Hugo Install stuff, and choosing our favourite theme from themes.gohugo.io for starters, etc. etc., and then install Netlify CMS afterwards by following the instructions at https://www.netlifycms.org/docs/add-to-your-site/.

2 Likes

I have gone down this path. But adding Netlify-CMS requires editing of the theme. As soon as I edited the theme locally and pushed the changes to remote, I get the following build error:

7:58:44 AM: Error checking out submodules: Submodule 'themes/terminal' (https://github.com/panr/hugo-theme-terminal.git) registered for path 'themes/terminal'

Cloning into ‘/opt/build/repo/themes/terminal’…
error: Server does not allow request for unadvertised object f67f9371ab9880948bb2f55a2d14307e5bb63ee4
Fetched in submodule path ‘themes/terminal’, but it did not contain f67f9371ab9880948bb2f55a2d14307e5bb63ee4. Direct fetching of that commit failed.
7:58:44 AM: Failing build: Failed to prepare repo
7:58:44 AM: failed during stage ‘preparing repo’: Error checking out submodules: Submodule ‘themes/terminal’ (https://github.com/panr/hugo-theme-terminal.git) registered for path ‘themes/terminal’
Cloning into ‘/opt/build/repo/themes/terminal’…
error: Server does not allow request for unadvertised object f67f9371ab9880948bb2f55a2d14307e5bb63ee4
Fetched in submodule path ‘themes/terminal’, but it did not contain f67f9371ab9880948bb2f55a2d14307e5bb63ee4. Direct fetching of that commit failed.
: exit status 1

Please help!