Skip to content

Commit

Permalink
Fix paths on Windows systems (replace \\ with /)
Browse files Browse the repository at this point in the history
  • Loading branch information
r-win committed Mar 19, 2024
1 parent 5d44cea commit 7fc21f7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions layouts/partials/page-meta-links-azure.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{{ $path := strings.TrimPrefix (add hugo.WorkingDir "/") $.File.Filename -}}
{{ $pathFormatted := replace .File.Path "\\" "/" -}}
{{ $path := strings.TrimPrefix (add (replace hugo.WorkingDir "\\" "/") "/") (replace $.File.Filename "\\" "/") -}}
{{ $az_repo := ($.Param "azure_repo") -}}
{{ $az_subdir := ($.Param "azure_subdir") -}}
{{ $az_project_repo := ($.Param "azure_project_repo") -}}
Expand All @@ -15,14 +14,14 @@
{{ $azs_base = $azs_base.from -}}
{{ end -}}
{{ with $azs_base -}}
{{ $path = replaceRE . $azs_rename $az_repo_path -}}
{{ $path = replaceRE . $azs_rename $path -}}
{{ end -}}

{{ $az_repo_path := printf "%s/%s/%s" $az_branch $az_subdir $path -}}
{{ $az_repo_path := printf "%s/%s" $az_subdir $path -}}
{{ $az_repo_path = replaceRE "//+" "/" $az_repo_path -}}

{{ $baseUrl := replaceRE "/_git/.+$" "" $az_repo }}
{{ $viewURL := printf "%s?path=%s&_a=contents" $az_repo $az_repo_path -}}
{{ $viewURL := printf "%s?path=%s&version=GB%s&_a=contents" $az_repo $az_repo_path $az_branch -}}
{{ $issuesURL := printf "%s/_workitems/create/Bug?[title]=%s" $baseUrl (safeURL $.Title ) -}}
{{ if $az_issue_area -}}
{{ $issuesURL = printf "%s/_workitems/create/Bug?[title]=%s&[Area Path]=%s" $baseUrl (safeURL $.Title) (safeURL $az_issue_area) -}}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/page-meta-links-github.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{/* cSpell:ignore querify subdir */ -}}
{{/* Class names ending with `--KIND` are deprecated in favor of `__KIND`, but we're keeping them for a few releases after 0.9.0 */ -}}

{{ $path := strings.TrimPrefix (add hugo.WorkingDir "/") $.File.Filename -}}
{{ $path := strings.TrimPrefix (add (replace hugo.WorkingDir "\\" "/") "/") (replace $.File.Filename "\\" "/") -}}
{{ $gh_repo := $.Param "github_repo" -}}
{{ $gh_url := $.Param "github_url" -}}
{{ $gh_subdir := $.Param "github_subdir" | default "" -}}
Expand Down

0 comments on commit 7fc21f7

Please sign in to comment.