Skip to content

Commit

Permalink
Fix relative path rendering failed (#1367)
Browse files Browse the repository at this point in the history
* Fix inaccurate logic of isUrlRemote

* Fix relate path link rendering failed
  • Loading branch information
wu0407 authored Oct 14, 2024
1 parent 0f6c663 commit ab6558f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion layouts/partials/function/isUrlRemote.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{- return .Host | and .Path | and (strings.HasSuffix .Path "/" | not) -}}
{{- return and (not (eq .Scheme "")) .Host -}}
5 changes: 3 additions & 2 deletions layouts/partials/function/resource.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{{- $resource := 0 -}}
{{- $url := urls.Parse .Path -}}
{{- if not (partial "function/isUrlRemote.html" $url) -}}
{{- $dest := strings.TrimPrefix "./" $url.Path -}}
{{- if .Resources -}}
{{- with .Resources.GetMatch $url.Path -}}
{{- with .Resources.GetMatch $dest -}}
{{- $resource = . -}}
{{- end -}}
{{- end -}}
{{- if not $resource -}}
{{- with resources.Get $url.Path -}}
{{- with resources.Get $dest -}}
{{- $resource = . -}}
{{- end -}}
{{- end -}}
Expand Down

0 comments on commit ab6558f

Please sign in to comment.