Howto: Run the hugo docs offline

Just run hugo server in the docs folder:

cd /root-of-hugo-folder/docs

hugo server

That’s it :slight_smile:

3 Likes

Hmm, I tried this but I expected the docs to look identical to the gohugo.io site. They didn’t. The theme wasn’t applied. I tried:

hugo server --theme=owl
hugo server -t owl

I guessed owl but obviously was wrong. Can I run my localhost with the same theme for the Hugo docs as I see on the live site?

I just run

hugo server

Sometimes

hugo server -w

And the site looks EXACTLY like the live one.

What OS do you run? Windows?

Sorry for the slooow reply. Got extra involved in work life.

I’m running on a Mac 10.9 Mavericks. Thought it might be a, ahem, personal issue with my personal Mac.

So, I reinstalled hugo with brew on my work machine. Brand new hugo install. Then I cloned a brand new hugo repo and started it up as instructed. Same deal as on my home machine. Except on my work machine I’m running Yosemite 10.10.1. Very weird. Browser is chrome but I doubt that is it.

The first page of the site shows up looking how I expect. The secondary pages not at all. Dangabit…seems I’m a new user and can’t paste an image…whelp. I can see that the start on hugo generator is throwing errors.

$ hugo server
ERROR: 2015/02/06 template: partials/header.html:8:12: executing "partials/header.html" at <.Hugo.Generator>: Hugo is not a field of struct type *hugolib.Node in partials/header.html
ERROR: 2015/02/06 template: partials/footer.html:2:107: executing "partials/footer.html" at <.Hugo.Version>: Hugo is not a field of struct type *hugolib.Node in partials/footer.html

I have hugo .12 installed through brew

Haven’t read this whole thread, but looking at that last error:

<.Hugo.Generator>

Was introduced in 0.13. So it’s looking like you are running hugo 0.12 binary on 0.13 docs.

Well, I cloned the Steve’s repo itself and checked out the branch direct – just to rule out git eff ups as much as possible.

I’m still getting template errors and seeing problems. Though, now the secondary pages at least have the menus, not all of them are appearing.

Error message is now:

 ERROR: 2015/02/07 template: partials/menu.html:34:46: executing "partials/menu.html" at <$File.FileName>: FileName is not a field of struct type source.File in partials/menu.html

The errors you see indicates old Hugo version (i.e. what you think you build isn’t what your running, path issues, GOPATH issues).

What’s the output of “hugo version”?

Sorted. I went back to my home machine. Reinstalled Hugo and the repo, I’m getting the expected result. Thanks for the help.

1 Like

Thanks @natefinch. I’ve just forked the hugo repo, and cloned it locally. When I run hugo server --buildDrafts --watch -v from within my hugo/docs, I get:

ERROR: 2015/04/27 template: partials/menu.html:24:36: executing "partials/menu.html" at <.URL>: URL is not a field of struct type *hugolib.MenuEntry in partials/menu.html

… at the terminal. The view of the docs is broken, with the page content in the sidebar.

My hugo version gives:

Hugo Static Site Generator v0.13 BuildDate: 2015-04-14T17:51:40+09:00

Anyone have an idea of what I can do to fix this? Thank you in advance.

You are running 0.14 docs on Hugo 0.13.

This would normally work fine - but we have depracated some fields and methods (or, renamed them) in 0.14. With Hugo 0.14 both variants works, in 0.13 only the old.

So for you, either

  1. Get the 0.13 docs
  2. Build the 0.14 Hugo
1 Like

Thanks @bjornerik, ah ha, I see.

@bjornerik is there any way to see what fields and methods have been deprecated or renamed since 0.13? Like the “what’s changed” section on the release notes.

I see from the docs that I can download go and compile (I’m on a Mac so we’ll have to see if it works). But it would be good to know what I’m in for, if I update and break my templates.

There aren’t any breaking changes in 0.14 (it wasn’t really in 0.13, either, maybe some subtle shortcode changes).

When running 0.14 you will get some informational errors about changing Url => URL etc. before 0.15 (when we will remove them).

We have done some spring cleaning in 0.14 – but in a gentle and informative way – better to do it at 0.14 with 2000 users than in 1.2 with 100000 users.

I develop Hugo, but I have also many Hugo sites - and I always run with the latest. I will know pretty fast if something is breaking.

1 Like

Ok. Thanks @bjornerik. I think I’ll try to compile it for mac.
Unless there are already compiled binaries for dev?

No dev binaries.

But it’s well worth it to get to know the Go build process. It’s not hard and Go is way cool.

1 Like

Ok! I’ll give it a whirl.

Although on OSX there is Brew / Home brew where there should be a dev target …

1 Like

Thanks for the tip @bjornerik :slight_smile:

Actually @bjornerik, I cleaned up macports and fink off my system, and some other detritus, and standardized on homebrew today. I could then easily install using brew install hugo --HEAD without trouble. Nice, thanks, it works. I have a few template edits to make but no biggie.

Probably a dumb question: Where is the hugo folder (and the docs folder) located?
I’m on Linux Manjaro (based on Arch)…