From 0bd512125059c23d9e7c0c38e3d2baba99596627 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Mon, 12 Feb 2018 09:31:14 +0100 Subject: [PATCH] Improve the Netlify versioning docs --- .../hosting-and-deployment/hosting-on-netlify.md | 14 ++++++++++---- content/troubleshooting/faq.md | 7 ++++++- layouts/shortcodes/code.html | 2 +- layouts/shortcodes/readfile.html | 2 ++ 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/content/hosting-and-deployment/hosting-on-netlify.md b/content/hosting-and-deployment/hosting-on-netlify.md index 0e84f55eb..ada1a56dc 100644 --- a/content/hosting-and-deployment/hosting-on-netlify.md +++ b/content/hosting-and-deployment/hosting-on-netlify.md @@ -59,7 +59,7 @@ Select the repo you want to use for continuous deployment. If you have a large n Once selected, you'll be brought to a screen for basic setup. Here you can select the branch you wanted published, your [build command][], and your publish (i.e. deploy) directory. The publish directory should mirror that of what you've set in your [site configuration][config], the default of which is `public`. The following steps assume you are publishing from the `master` branch. -### Build with a Specific Hugo Version +## Build with a Specific Hugo Version Setting the build command to `hugo` will build your site according to the current default Hugo version used by Netlify. @@ -79,15 +79,21 @@ For production: ``` [context.production.environment] - HUGO_VERSION = "0.26" + HUGO_VERSION = "0.36" ``` For testing: ``` [context.deploy-preview.environment] - HUGO_VERSION = "0.26" -``` + HUGO_VERSION = "0.36" +``` + +The Netlify configuration file can be a little hard to understand and get right for the different, and you may get some inspiration and tips from this site's `netlify.toml`: + +{{< code file="netlify.toml" nocode="true" >}} +{{< readfile file="netlify.toml" highlight="toml" >}} +{{< /code >}} Selecting "Deploy site" will immediately take you to a terminal for your build:. diff --git a/content/troubleshooting/faq.md b/content/troubleshooting/faq.md index 400bba897..b6fc9407f 100644 --- a/content/troubleshooting/faq.md +++ b/content/troubleshooting/faq.md @@ -29,4 +29,9 @@ How automate the "publish at intervals" part depends on your situation: Also see this Twitter thread: -{{< tweet 962380712027590657 >}} \ No newline at end of file +{{< tweet 962380712027590657 >}} + +## Can I use the latest Hugo version on Netlify? + +Yes you can! Read [this](/hosting-and-deployment/hosting-on-netlify/#build-with-a-specific-hugo-version). + diff --git a/layouts/shortcodes/code.html b/layouts/shortcodes/code.html index f40cf071d..4c12b0f29 100644 --- a/layouts/shortcodes/code.html +++ b/layouts/shortcodes/code.html @@ -11,7 +11,7 @@ {{/* Functionality located within filesaver.js The copy here is located in the css with .copy class so it can be replaced with JS on success */}} {{end}}
- {{ if $isHTML }}{{- highlight .Inner "html" "" | -}}{{ else }}
{{- .Inner | string -}}
{{ end }} + {{ if .Get "nocode" }}{{ .Inner }}{{ else }}{{ if $isHTML }}{{- highlight .Inner "html" "" | -}}{{ else }}
{{- .Inner | string -}}
{{ end }}{{ end }}
diff --git a/layouts/shortcodes/readfile.html b/layouts/shortcodes/readfile.html index f777abe26..36400ac55 100644 --- a/layouts/shortcodes/readfile.html +++ b/layouts/shortcodes/readfile.html @@ -1,6 +1,8 @@ {{$file := .Get "file"}} {{- if eq (.Get "markdown") "true" -}} {{- $file | readFile | markdownify -}} +{{- else if (.Get "highlight") -}} +{{- highlight ($file | readFile) (.Get "highlight") "" -}} {{- else -}} {{ $file | readFile | safeHTML }} {{- end -}} \ No newline at end of file