Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: zirain <zirain2009@gmail.com>
  • Loading branch information
zirain committed Jan 13, 2025
1 parent 67215d7 commit 19becbe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion site/layouts/_default/_markup/render-image.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{{ $baseURL := site.BaseURL }}
<img src="{{ $baseURL }}{{ .Destination | safeURL }}"
{{ $safeURL := .Destination | safeURL }}
{{ if and (ne $baseURL "/") (not (or (strings.HasPrefix $safeURL "https://") (strings.HasPrefix $safeURL "http://") (strings.HasPrefix $safeURL "mailto:"))) }}
{{ $safeURL = printf "%s%s" $baseURL $safeURL }}
{{ end }}
<img src="{{ $safeURL }}"
{{- with .PlainText }} alt="{{ . }}"{{ end -}}
{{- with .Title }} title="{{ . }}"{{ end -}}
>
Expand Down
4 changes: 4 additions & 0 deletions site/layouts/partials/navbar-version-selector.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
{{ $path = .Page.RelPermalink -}}
{{ end -}}
{{ range .Site.Params.versions -}}
{{ if ne $baseURL "/" }}
<li><a class="dropdown-item" href="{{ $baseURL }}{{ .url }}{{ $path }}">{{ .version }}</a></li>
{{ else }}
<li><a class="dropdown-item" href="{{ .url }}{{ $path }}">{{ .version }}</a></li>
{{ end }}
{{ end -}}
</ul>
</div>

0 comments on commit 19becbe

Please sign in to comment.