fix: fix edit page link and auto-detect contentDir (#343)
BREAKING CHANGE: With support of the multilingual mode, we broke the `edit page` links, as the content directory was statically hard-coded into the `GeekdocEditPath` parameter. To get the correct content directory, regardless of the language or a disabled multilingual mode, we now use Hugo's built-in `.Site.Params.contentDir` parameter. Therefor, you have to remove the hard-coded `/content` part from the `geekdocEditPath` parameter in the configuration of your project.uci-hugo-doc
parent
4e93b70b7b
commit
c9f809ca19
|
@ -21,5 +21,8 @@ exampleSite/content/de
|
||||||
/exampleSite/resources/
|
/exampleSite/resources/
|
||||||
/exampleSite/data/sprites/
|
/exampleSite/data/sprites/
|
||||||
|
|
||||||
|
# hugo
|
||||||
|
.hugo_build.lock
|
||||||
|
|
||||||
# testing
|
# testing
|
||||||
.lighthouseci/
|
.lighthouseci/
|
||||||
|
|
|
@ -8,7 +8,7 @@ geekdocToC: 3
|
||||||
geekdocTagsToMenu: true
|
geekdocTagsToMenu: true
|
||||||
|
|
||||||
geekdocRepo: https://github.com/thegeeklab/hugo-geekdoc
|
geekdocRepo: https://github.com/thegeeklab/hugo-geekdoc
|
||||||
geekdocEditPath: edit/main/exampleSite/content
|
geekdocEditPath: edit/main/exampleSite
|
||||||
|
|
||||||
geekdocSearch: true
|
geekdocSearch: true
|
||||||
geekdocSearchShowParent: true
|
geekdocSearchShowParent: true
|
||||||
|
|
|
@ -50,7 +50,7 @@ enableRobotsTXT = true
|
||||||
geekdocMenuBundle = true
|
geekdocMenuBundle = true
|
||||||
|
|
||||||
# (Optional, default false) Collapse all menu entries, can not be overwritten
|
# (Optional, default false) Collapse all menu entries, can not be overwritten
|
||||||
# per page if enabled. Can be enabled per page via `geekdocCollapseSection`.
|
# per page if enabled. Can be enabled per page via 'geekdocCollapseSection'.
|
||||||
geekdocCollapseAllSections = true
|
geekdocCollapseAllSections = true
|
||||||
|
|
||||||
# (Optional, default true) Show page navigation links at the bottom of each
|
# (Optional, default true) Show page navigation links at the bottom of each
|
||||||
|
@ -66,9 +66,9 @@ enableRobotsTXT = true
|
||||||
geekdocRepo = "https://github.com/thegeeklab/hugo"
|
geekdocRepo = "https://github.com/thegeeklab/hugo"
|
||||||
|
|
||||||
# (Optional, default none) Enable 'Edit page' links. Requires 'GeekdocRepo' param
|
# (Optional, default none) Enable 'Edit page' links. Requires 'GeekdocRepo' param
|
||||||
# and path must point to 'content' directory of repo.
|
# and the path must point to the parent directory of the 'content' folder.
|
||||||
# You can also specify this parameter per page in front matter.
|
# You can also specify this parameter per page in front matter.
|
||||||
geekdocEditPath = "edit/main/exampleSite/content"
|
geekdocEditPath = "edit/main/exampleSite"
|
||||||
|
|
||||||
# (Optional, default true) Enables search function with flexsearch.
|
# (Optional, default true) Enables search function with flexsearch.
|
||||||
# Index is built on the fly and might slow down your website.
|
# Index is built on the fly and might slow down your website.
|
||||||
|
@ -163,7 +163,7 @@ params:
|
||||||
geekdocMenuBundle: true
|
geekdocMenuBundle: true
|
||||||
|
|
||||||
# (Optional, default false) Collapse all menu entries, can not be overwritten
|
# (Optional, default false) Collapse all menu entries, can not be overwritten
|
||||||
# per page if enabled. Can be enabled per page via `geekdocCollapseSection`.
|
# per page if enabled. Can be enabled per page via 'geekdocCollapseSection'.
|
||||||
geekdocCollapseAllSections: true
|
geekdocCollapseAllSections: true
|
||||||
|
|
||||||
# (Optional, default true) Show page navigation links at the bottom of each
|
# (Optional, default true) Show page navigation links at the bottom of each
|
||||||
|
@ -178,10 +178,10 @@ params:
|
||||||
# You can also specify this parameter per page in front matter.
|
# You can also specify this parameter per page in front matter.
|
||||||
geekdocRepo: "https://github.com/thegeeklab/hugo-geekdoc"
|
geekdocRepo: "https://github.com/thegeeklab/hugo-geekdoc"
|
||||||
|
|
||||||
# (Optional, default none) Enable "Edit page" links. Requires 'GeekdocRepo' param
|
# (Optional, default none) Enable 'Edit page' links. Requires 'GeekdocRepo' param
|
||||||
# and path must point to 'content' directory of repo.
|
# and the path must point to the parent directory of the 'content' folder.
|
||||||
# You can also specify this parameter per page in front matter.
|
# You can also specify this parameter per page in front matter.
|
||||||
geekdocEditPath: edit/main/exampleSite/content
|
geekdocEditPath: edit/main/exampleSite
|
||||||
|
|
||||||
# (Optional, default true) Enables search function with flexsearch.
|
# (Optional, default true) Enables search function with flexsearch.
|
||||||
# Index is built on the fly and might slow down your website.
|
# Index is built on the fly and might slow down your website.
|
||||||
|
@ -262,9 +262,9 @@ geekdocBreadcrumb = false
|
||||||
# Set source repository location.
|
# Set source repository location.
|
||||||
geekdocRepo = "https://github.com/thegeeklab/hugo-geekdoc"
|
geekdocRepo = "https://github.com/thegeeklab/hugo-geekdoc"
|
||||||
|
|
||||||
# Enable "Edit page" links. Requires 'GeekdocRepo' param and path must point
|
# Enable 'Edit page' links. Requires 'GeekdocRepo' param and the path must point to
|
||||||
# to 'content' directory of repo.
|
# the parent directory of the 'content' folder.
|
||||||
geekdocEditPath = "edit/main/exampleSite/content"
|
geekdocEditPath = "edit/main/exampleSite"
|
||||||
|
|
||||||
# Used for 'Edit page' link, set to '.File.Path' by default.
|
# Used for 'Edit page' link, set to '.File.Path' by default.
|
||||||
# Can be overwritten by a path relative to 'geekdocEditPath'
|
# Can be overwritten by a path relative to 'geekdocEditPath'
|
||||||
|
@ -322,9 +322,9 @@ geekdocBreadcrumb: false
|
||||||
# Set source repository location.
|
# Set source repository location.
|
||||||
geekdocRepo: "https://github.com/thegeeklab/hugo-geekdoc"
|
geekdocRepo: "https://github.com/thegeeklab/hugo-geekdoc"
|
||||||
|
|
||||||
# Enable "Edit page" links. Requires 'GeekdocRepo' param and path must point
|
# Enable 'Edit page' links. Requires 'GeekdocRepo' param and the path must point to
|
||||||
# to 'content' directory of repo.
|
# the parent directory of the 'content' folder.
|
||||||
geekdocEditPath: "edit/main/exampleSite/content"
|
geekdocEditPath: "edit/main/exampleSite"
|
||||||
|
|
||||||
# Used for 'Edit page' link, set to '.File.Path' by default.
|
# Used for 'Edit page' link, set to '.File.Path' by default.
|
||||||
# Can be overwritten by a path relative to 'geekdocEditPath'
|
# Can be overwritten by a path relative to 'geekdocEditPath'
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{{ $geekdocRepo := default (default false .Site.Params.GeekdocRepo) .Page.Params.GeekdocRepo }}
|
{{ $geekdocRepo := default (default false .Site.Params.GeekdocRepo) .Page.Params.GeekdocRepo }}
|
||||||
{{ $geekdocEditPath := default (default false .Site.Params.GeekdocEditPath) .Page.Params.GeekdocEditPath }}
|
{{ $geekdocEditPath := default (default false .Site.Params.GeekdocEditPath) .Page.Params.GeekdocEditPath }}
|
||||||
{{ if .File }}
|
{{ if .File }}
|
||||||
{{ $.Scratch.Set "geekdocFilePath" (default .File.Path .Page.Params.GeekdocFilePath) }}
|
{{ $.Scratch.Set "geekdocFilePath" (default (path.Join .Site.Params.contentDir .File.Path) .Page.Params.GeekdocFilePath) }}
|
||||||
{{ else }}
|
{{ else }}
|
||||||
{{ $.Scratch.Set "geekdocFilePath" false }}
|
{{ $.Scratch.Set "geekdocFilePath" false }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
Loading…
Reference in New Issue