From ab67fcc80ea7471cc229f4ffd05b058d9633f0b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Fri, 9 Jun 2023 20:28:03 +0200 Subject: [PATCH] test: modularize config --- exampleSite/{ => config/_default}/config.toml | 5 ----- exampleSite/config/testing/config.toml | 21 +++++++++++++++++++ exampleSite/test.bat | 6 +----- exampleSite/test.min.bat | 5 +---- 4 files changed, 23 insertions(+), 14 deletions(-) rename exampleSite/{ => config/_default}/config.toml (97%) create mode 100644 exampleSite/config/testing/config.toml diff --git a/exampleSite/config.toml b/exampleSite/config/_default/config.toml similarity index 97% rename from exampleSite/config.toml rename to exampleSite/config/_default/config.toml index 73e06c3711..27c3c30640 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config/_default/config.toml @@ -36,11 +36,6 @@ defaultContentLanguage = "en" # the site's title of this showcase; you should change this ;-) title = "Hugo Relearn Documentation" -# We disable this for testing the exampleSite; you must do so too -# if you want to use the themes parameter disableGeneratorVersion=true; -# otherwise Hugo will create a generator tag on your home page -disableHugoGeneratorInject = true - [outputs] # add JSON to the home to support Lunr search; This is a mandatory setting # for the search functionality diff --git a/exampleSite/config/testing/config.toml b/exampleSite/config/testing/config.toml new file mode 100644 index 0000000000..4b1fe304eb --- /dev/null +++ b/exampleSite/config/testing/config.toml @@ -0,0 +1,21 @@ +# We disable this for testing the exampleSite; you must do so too +# if you want to use the themes parameter disableGeneratorVersion=true; +# otherwise Hugo will create a generator tag on your home page +disableHugoGeneratorInject = true + +# We are pretty sure, to not have unintentionally untranslated titles; +# it may happen in case when shortcodes want to set an automatic title +# out of a given style setting (this is allowed to fail for non severity styles) +# enableMissingTranslationPlaceholders = true + +# Audit your published site for problems +# https://discourse.gohugo.io/t/audit-your-published-site-for-problems/35184/12?u=mcshelby +[minify] + [minify.tdewolff] + [minify.tdewolff.html] + keepComments = true + +[params] + disableGeneratorVersion = true + disableAssetsBusting = true + disableRandomIds = true diff --git a/exampleSite/test.bat b/exampleSite/test.bat index abcca1ccd6..0ad722b33b 100644 --- a/exampleSite/test.bat +++ b/exampleSite/test.bat @@ -2,10 +2,7 @@ setlocal enabledelayedexpansion set /p version=<..\layouts\partials\version.txt echo %version%>metrics.%version%.log -echo disableAssetsBusting=true>>config.toml -echo disableGeneratorVersion=true>>config.toml -echo disableRandomIds=true>>config.toml -hugo --templateMetrics --templateMetricsHints --cleanDestinationDir --destination public.%version% >> metrics.%version%.log +hugo --environment testing --templateMetrics --templateMetricsHints --cleanDestinationDir --destination public.%version% >> metrics.%version%.log set "start_dir=%CD%\public.%version%" set "output_file=dir.%version%.log" @@ -17,6 +14,5 @@ for /r "%start_dir%" %%F in (*) do ( move /Y dir.%version%.log public.%version%\dir.log 2>&1 >NUL move /Y metrics.%version%.log public.%version%\metrics.log 2>&1 >NUL -git restore config.toml For /F "UseBackQ Delims==" %%A In ("public.%version%\metrics.log") Do Set "lastline=%%A" echo %lastline% diff --git a/exampleSite/test.min.bat b/exampleSite/test.min.bat index 0ca605895b..48fd5997a3 100644 --- a/exampleSite/test.min.bat +++ b/exampleSite/test.min.bat @@ -5,9 +5,7 @@ set hugo_minor=95 set hugo_patch=0 set /p version=<..\layouts\partials\version.txt echo %version%>metrics.%version%.hugo.%hugo_major%.%hugo_minor%.%hugo_patch%.log -echo disableAssetsBusting=true>>config.toml -echo disableGeneratorVersion=true>>config.toml -hugo.%hugo_major%.%hugo_minor%.%hugo_patch% --templateMetrics --templateMetricsHints --cleanDestinationDir --destination public.%version%.hugo.%hugo_major%.%hugo_minor%.%hugo_patch% >> metrics.%version%.hugo.%hugo_major%.%hugo_minor%.%hugo_patch%.log +hugo.%hugo_major%.%hugo_minor%.%hugo_patch% --environment testing --templateMetrics --templateMetricsHints --cleanDestinationDir --destination public.%version%.hugo.%hugo_major%.%hugo_minor%.%hugo_patch% >> metrics.%version%.hugo.%hugo_major%.%hugo_minor%.%hugo_patch%.log set "start_dir=%CD%\public.%version%.hugo.%hugo_major%.%hugo_minor%.%hugo_patch%" set "output_file=dir.%version%.hugo.%hugo_major%.%hugo_minor%.%hugo_patch%.log" @@ -19,6 +17,5 @@ for /r "%start_dir%" %%F in (*) do ( move /Y dir.%version%.hugo.%hugo_major%.%hugo_minor%.%hugo_patch%.log public.%version%.hugo.%hugo_major%.%hugo_minor%.%hugo_patch%\dir.log 2>&1 >NUL move /Y metrics.%version%.hugo.%hugo_major%.%hugo_minor%.%hugo_patch%.log public.%version%.hugo.%hugo_major%.%hugo_minor%.%hugo_patch%\metrics.log 2>&1 >NUL -git restore config.toml For /F "UseBackQ Delims==" %%A In ("public.%version%.hugo.%hugo_major%.%hugo_minor%.%hugo_patch%\metrics.log") Do Set "lastline=%%A" echo %lastline%