summaryrefslogtreecommitdiffstats
path: root/tpl/tplimpl/embedded/templates/_default/_markup
diff options
context:
space:
mode:
Diffstat (limited to 'tpl/tplimpl/embedded/templates/_default/_markup')
-rw-r--r--tpl/tplimpl/embedded/templates/_default/_markup/render-image.html11
-rw-r--r--tpl/tplimpl/embedded/templates/_default/_markup/render-link.html9
2 files changed, 14 insertions, 6 deletions
diff --git a/tpl/tplimpl/embedded/templates/_default/_markup/render-image.html b/tpl/tplimpl/embedded/templates/_default/_markup/render-image.html
index 013e31235..89514cb83 100644
--- a/tpl/tplimpl/embedded/templates/_default/_markup/render-image.html
+++ b/tpl/tplimpl/embedded/templates/_default/_markup/render-image.html
@@ -1,11 +1,18 @@
{{- $u := urls.Parse .Destination -}}
{{- $src := $u.String -}}
{{- if not $u.IsAbs -}}
- {{- with or (.PageInner.Resources.Get $u.Path) (resources.Get $u.Path) -}}
+ {{- $path := strings.TrimPrefix "./" $u.Path }}
+ {{- with or (.PageInner.Resources.Get $path) (resources.Get $path) -}}
{{- $src = .RelPermalink -}}
+ {{- with $u.RawQuery -}}
+ {{- $src = printf "%s?%s" $src . -}}
+ {{- end -}}
+ {{- with $u.Fragment -}}
+ {{- $src = printf "%s#%s" $src . -}}
+ {{- end -}}
{{- end -}}
{{- end -}}
-{{- $attributes := merge .Attributes (dict "alt" .Text "src" $src "title" .Title) -}}
+{{- $attributes := merge .Attributes (dict "alt" .Text "src" $src "title" (.Title | transform.HTMLEscape)) -}}
<img
{{- range $k, $v := $attributes -}}
{{- if $v -}}
diff --git a/tpl/tplimpl/embedded/templates/_default/_markup/render-link.html b/tpl/tplimpl/embedded/templates/_default/_markup/render-link.html
index 8903d3dfb..daf3f11e1 100644
--- a/tpl/tplimpl/embedded/templates/_default/_markup/render-link.html
+++ b/tpl/tplimpl/embedded/templates/_default/_markup/render-link.html
@@ -3,10 +3,11 @@
{{- if strings.HasPrefix $u.String "#" }}
{{- $href = printf "%s#%s" .PageInner.RelPermalink $u.Fragment }}
{{- else if not $u.IsAbs -}}
+ {{- $path := strings.TrimPrefix "./" $u.Path }}
{{- with or
- ($.PageInner.GetPage $u.Path)
- ($.PageInner.Resources.Get $u.Path)
- (resources.Get $u.Path)
+ ($.PageInner.GetPage $path)
+ ($.PageInner.Resources.Get $path)
+ (resources.Get $path)
-}}
{{- $href = .RelPermalink -}}
{{- with $u.RawQuery -}}
@@ -17,7 +18,7 @@
{{- end -}}
{{- end -}}
{{- end -}}
-{{- $attributes := dict "href" $href "title" .Title -}}
+{{- $attributes := dict "href" $href "title" (.Title | transform.HTMLEscape) -}}
<a
{{- range $k, $v := $attributes -}}
{{- if $v -}}