HugoDocs - include public dir in git repository


#1

Requirement: I need offline Hugo documentation (daily 4 hour power outages, Internet down.)
Problem: I cloned hugoDocs from Github, but have a horde of errors when I either run Hugo server or execute Hugo build locally. (Message when building: “Error building site: logged 71 error(s)”)
Suggested feature: It might not be a bad idea to include the pre-built /public directory in the Github repository for HugoDocs since it is not included in the GitHub repo. This is effectively what I require - pre-built .html output, the source is great for learning from, but not ideal as documentation.

Alternative solution (short): Is it to build the site with full output in /public disregarding/ignoring errors? I searched, could not find an obvious way.
Alternative solution (long): I have to identify which elements require the site to be online when building it, or have to comment those elements in the doc code. (I tried, wasted some time, gave up.)

Any pointers will be appreciated.


#2

I believe, and someone will correct me if I am wrong, that you can just clone the repo and build it with hugo server. But I see you have already tried that, so not sure what is going on there.


#3

That is what I also thought. It is easier (and faster) to just publish the HTML inside public in Github than try to hunt the error down.


#4

Hi,

What sorts of errors do you get when you try to build the Hugo Docs? I cloned it just now and it builds fine on my machine.

Also what hugo version are you running?


#5

A code repository like GIT is there to NOT have generated files included. It would be much more interesting to know what errors come up in your trial - which would point to probably you having a not compatible Hugo version installed or a very deep file path for your extracted repo.

A better way is to just download the website with a tool like wget regularly. That leaves the chore of a task that would take development time in your own hands.


#6

Thanks for the response.

The Hugo version is

Hugo Static Site Generator v0.45 linux/amd64 BuildDate: 2018-07-22T12:09:29Z

the repo root path is ~/hugo/hugoDocs/

the OS is Ubuntu 18.04

wget - For the longest time it has been consider bad behaviour to use wget to recursively download a site due to issues of both bandwidth and potentially affecting the experience of other users. But that remains an option easily done.

Errors from hugo server -w :

ERROR 2018/11/30 14:54:36 Failed to add template "shortcodes/code.html" in path "shortcodes/code.html": template: shortcodes/code.html:5: unexpected "=" in operand
ERROR 2018/11/30 14:54:37 shortcodes/code.html : template: shortcodes/code.html:5: unexpected "=" in operand
e[?25lBuilding sites … ERROR 2018/11/30 14:54:37 Unable to locate template for shortcode "code" in page "getting-started/installing.md"
ERROR 2018/11/30 14:54:37 Unable to locate template for shortcode "code" in page "getting-started/code-toggle.md"
ERROR 2018/11/30 14:54:37 Unable to locate template for shortcode "code" in page "variables/taxonomy.md"
ERROR 2018/11/30 14:54:37 Unable to locate template for shortcode "code" in page "variables/site.md"
ERROR 2018/11/30 14:54:37 Unable to locate template for shortcode "code" in page "variables/page.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "templates/base.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "templates/single-page-templates.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "templates/menu-templates.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "templates/data-templates.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "templates/internal.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "templates/taxonomy-templates.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "templates/introduction.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "templates/partials.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "templates/shortcode-templates.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "templates/base.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "templates/section-templates.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "templates/404.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "templates/robots.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "templates/files.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "templates/homepage.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "templates/views.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "content-management/shortcodes.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "templates/lists.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "content-management/sections.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "content-management/summaries.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "content-management/multilingual.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "content-management/related.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "content-management/urls.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "content-management/taxonomies.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "content-management/organization/index.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "content-management/toc.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "content-management/image-processing/index.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "content-management/archetypes.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "content-management/syntax-highlighting.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "content-management/formats.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "content-management/types.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "hosting-and-deployment/hosting-on-netlify.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "hosting-and-deployment/hosting-on-gitlab.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "hosting-and-deployment/deployment-with-nanobox.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "hosting-and-deployment/hosting-on-github.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "hosting-and-deployment/deployment-with-rsync.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "hosting-and-deployment/deployment-with-wercker.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "about/license.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "about/new-in-032/index.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "functions/safeURL.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "functions/time.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "functions/group.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "functions/absurl.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "functions/GetPage.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "functions/where.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "functions/partialCached.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "functions/unix.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "functions/delimit.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "functions/relurl.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "functions/apply.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "functions/urlize.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "functions/dict.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "functions/after.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "functions/with.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "functions/slice.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "functions/base64.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "functions/shuffle.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "functions/len.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "contribute/themes.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "contribute/documentation.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "functions/default.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "contribute/development.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "functions/adddate.md"
ERROR 2018/11/30 14:54:38 Unable to locate template for shortcode "code" in page "themes/installing-and-using-themes.md"

#7

You need to update to the latest Hugo version (0.52).

The errors referencing unexpected "=" in operand are probably from some refactoring for 0.48.


#8

Yes, that worked like a charm.

Note to self, don’t install Hugo using Ubuntu repositories, download the latest Linux binary file from ( https://github.com/gohugoio/hugo/releases ) and copy hugo to the ~/.local/bin directory.


#9

If you are on Ubuntu (or any of its “flavours”) then install it via Snap. It’s the one that is updated the earliest and you don’t need to move files around.

snap install hugo --channel=extended installs the extended version.


#10

On a Debian based distro:

dpkg -i HugoDebFile.deb

#11

For now, I have the binary. But at some point I will probably go the snap route. Thanks for the tip about installing the extended version.