thegeeklab / hugo-geekdoc

Hugo theme made for documentation

Home Page:https://geekdocs.de

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

netlify.toml

MarcinKlejna opened this issue · comments

commented

Can anybody suggest how to create a netlify.toml file to publish my website in this template?
Thank you

This is just a Hugo theme. Deployments are completely unrelated to the used theme. For Hugo itself, please check the docs https://gohugo.io/hosting-and-deployment/hosting-on-netlify/

Maybe I misunderstood your initial question a bit. You are looking for a way to download the release tarball of the theme as the submodule way is not working out-of-the-box right?

Here are some possible solutions:

  • add a Makefile to your repo to bundle the required steps:
THEME_VERSION := v0.8.2
THEME := hugo-geekdoc
BASEDIR := docs
THEMEDIR := $(BASEDIR)/themes

.PHONY: doc
doc: doc-assets doc-build

.PHONY: doc-assets
doc-assets:
	mkdir -p $(THEMEDIR)/$(THEME)/ ; \
	curl -sSL "https://github.com/thegeeklab/$(THEME)/releases/download/${THEME_VERSION}/$(THEME).tar.gz" | tar -xz -C $(THEMEDIR)/$(THEME)/ --strip-components=1

.PHONY: doc-build
doc-build:
        cd $(BASEDIR); hugo

.PHONY: clean
clean:
	rm -rf $(THEMEDIR) && \
        rm -rf $(BASEDIR)/public

This Makfile can be used in your netlify.toml:

[build]
publish = "docs/public"
command = "make doc"

See https://docs.netlify.com/configure-builds/file-based-configuration/#sample-file

  • you can also chain all required commands to prepare the theme and build your site on the command option like this:
[build]
publish = "docs/public"
command = "command1 && command 2 && command3 && hugo"

Whatever solution you choose, the main goal is to ensure you (or netlify) downloads the prebuilt theme release tarball or run the required npm/gulp command to pre-process the theme assets before running the hugo build command. Hope that helps.

commented

Thank you very much.