diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 3224ce77db..c7aba1fede 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -1,4 +1,5 @@ baseURL = "https://example.com" +canonifyURLs = true languageCode = "en" defaultContentLanguage = "en" @@ -40,7 +41,7 @@ relativeURLs = true title = "Documentation for Hugo Relearn Theme" weight = 1 languageName = "English" - landingPageURL = "/en" + landingPageURL = "/" landingPageName = " Home" [[Languages.en.menu.shortcuts]] @@ -56,7 +57,7 @@ relativeURLs = true [[Languages.en.menu.shortcuts]] name = " Showcases" - url = "showcase" + url = "/showcase/" weight = 11 [[Languages.en.menu.shortcuts]] @@ -67,14 +68,14 @@ relativeURLs = true [[Languages.en.menu.shortcuts]] name = " Credits" - url = "/credits" + url = "/credits/" weight = 30 [Languages.pir] title = "Documentat'n fer Cap'n Hugo Relearrrn Theme" weight = 1 languageName = "Arrr! Pirrrates" - landingPageURL = "/pir" + landingPageURL = "/pir/" landingPageName = " Arrr! Home" [[Languages.pir.menu.shortcuts]] @@ -90,7 +91,7 @@ relativeURLs = true [[Languages.pir.menu.shortcuts]] name = " Showcases" - url = "showcase" + url = "/showcase/" weight = 11 [[Languages.pir.menu.shortcuts]] @@ -101,5 +102,5 @@ relativeURLs = true [[Languages.pir.menu.shortcuts]] name = " Crrredits" - url = "/credits" + url = "/credits/" weight = 30 diff --git a/exampleSite/content/basics/configuration/_index.en.md b/exampleSite/content/basics/configuration/_index.en.md index eefbb1af38..40e0c47d6d 100644 --- a/exampleSite/content/basics/configuration/_index.en.md +++ b/exampleSite/content/basics/configuration/_index.en.md @@ -66,6 +66,17 @@ Note that some of these parameters are explained in details in other sections of titleSeparator = "-" ``` +## A word on running your site in a subfolder + +The theme runs best if your site is installed in the root of your webserver. If your site is served from a subfolder, eg. `https://example.com/mysite/`, you have to set the following lines to your `config.toml` + +````toml +baseURL = "https://example.com/mysite/" +canonifyURLs = true +```` + +Without `canonifyURLs=true` URLs in sublemental pages (like `sitemap.xml`, `rss.xml`) will be generated falsly while your HTML files will still work. See https://github.com/gohugoio/hugo/issues/5226. + ## Activate search If not already present, add the follow lines in the same `config.toml` file. @@ -101,12 +112,12 @@ appearance, you will have to configure two parameters for the defined languages: [Lanugages] [Lanugages.en] ... -landingPageURL = "/en" +landingPageURL = "/" landingPageName = " Home" ... [Lanugages.pir] ... -landingPageURL = "/pir" +landingPageURL = "/pir/" landingPageName = " Arrr! Homme" ... ``` diff --git a/exampleSite/layouts/partials/favicon.html b/exampleSite/layouts/partials/favicon.html index 7caaaa3228..48b528d2a0 100644 --- a/exampleSite/layouts/partials/favicon.html +++ b/exampleSite/layouts/partials/favicon.html @@ -1 +1,2 @@ - \ No newline at end of file +{{- $assetBusting := not .Site.Params.disableAssetsBusting -}} + \ No newline at end of file diff --git a/layouts/partials/menu.html b/layouts/partials/menu.html index b6b79354b9..e5e55dd1fb 100644 --- a/layouts/partials/menu.html +++ b/layouts/partials/menu.html @@ -55,18 +55,17 @@
- {{- $siteLanguages := .Site.Languages }} {{- $pageLang := .Page.Lang }} {{- range .Page.AllTranslations }} {{- $translation := . }} {{- range $siteLanguages }} {{- if eq $translation.Lang .Lang }} - {{- $selected := false }} {{- if eq $pageLang .Lang }} - + {{- else }} - + {{- end }} {{- end }} {{- end }} diff --git a/layouts/partials/meta.html b/layouts/partials/meta.html index 1d56dd9f3a..4fb098b3fe 100644 --- a/layouts/partials/meta.html +++ b/layouts/partials/meta.html @@ -4,14 +4,14 @@ {{- else }} {{- range .AlternativeOutputFormats }} {{- if ne .Name "JSON" }} - {{ printf `` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }} + {{- end }} {{- end }} {{- end }} {{- if and (ne .Site.Params.disableSeoHiddenPages true) (ne .Site.Params.disableSearchHiddenPages true) }} {{- range .AlternativeOutputFormats }} {{- if eq .Name "JSON" }} - {{ printf `` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }} + {{- end }} {{- end }} {{- end }}