diff --git a/.vscode/cspell.json b/.vscode/cspell.json index d3389d0e02..3e4a324385 100644 --- a/.vscode/cspell.json +++ b/.vscode/cspell.json @@ -2,5 +2,5 @@ { "version": "0.2", "caseSensitive": true, - "words": ["Docsy", "shortcode", "shortcodes"] + "words": ["Docsy", "hugo", "shortcode", "shortcodes", "warnf"] } diff --git a/CHANGELOG.md b/CHANGELOG.md index 0196561edf..9e1a15358a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ # Changelog @@ -25,13 +25,29 @@ For the full list of changes, see the [0.x.y] release notes. **Breaking changes**: -- ... +- [Repository Links] now work for [multi-language] sites ([#1744]). + + For any given page, repository links are now computed from a page's _resolved_ + `File` path, as resolved _through_ mount points, if any. That is, the path + used is the one that refers to the file's actual location on disk, not it's + logical path in Hugo's [union file system]. + + This is a breaking change pages of sites that use mounts and + [path_base_for_github_subdir]. Projects will need to adjust the value of + [path_base_for_github_subdir] to be relative to the file's physical location. **New**: **Other changes**: [0.x.y]: https://github.com/google/docsy/releases/latest?FIXME=v0.X.Y +[#1744]: https://github.com/google/docsy/pull/1744 +[multi-language]: https://www.docsy.dev/docs/language/ +[path_base_for_github_subdir]: + https://www.docsy.dev/docs/adding-content/repository-links/#path_base_for_github_subdir-optional +[Repository Links]: https://www.docsy.dev/docs/adding-content/repository-links/ +[union file system]: + https://gohugo.io/getting-started/directory-structure/#union-file-system ## 0.8.0 diff --git a/layouts/partials/page-meta-links.html b/layouts/partials/page-meta-links.html index 165e5a9f02..f34b6ebbbd 100644 --- a/layouts/partials/page-meta-links.html +++ b/layouts/partials/page-meta-links.html @@ -1,21 +1,18 @@ +{{/* cSpell:ignore querify subdir */ -}} {{ if .File -}} -{{ $pathFormatted := strings.TrimPrefix hugo.WorkingDir $.File.Filename -}} -{{ $gh_repo := ($.Param "github_repo") -}} -{{ $gh_url := ($.Param "github_url") -}} -{{ $gh_subdir := ($.Param "github_subdir") -}} -{{ $gh_project_repo := ($.Param "github_project_repo") -}} -{{ $gh_branch := (default "main" ($.Param "github_branch")) -}} +{{ $path := strings.TrimPrefix (add hugo.WorkingDir "/") $.File.Filename -}} +{{ $gh_repo := $.Param "github_repo" -}} +{{ $gh_url := $.Param "github_url" -}} +{{ $gh_subdir := $.Param "github_subdir" | default "" -}} +{{ $gh_project_repo := $.Param "github_project_repo" -}} +{{ $gh_branch := $.Param "github_branch" | default "main" -}}