Skip to content

Commit b960399

Browse files
committed
Test config for assets dir
Signed-off-by: Pedro Ielpi <[email protected]>
1 parent 471b71b commit b960399

File tree

3 files changed

+50
-0
lines changed

3 files changed

+50
-0
lines changed

hugo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,11 @@ version_menu = "Versions"
161161
[[module.imports]]
162162
path = "github.com/hugomods/swagger-ui"
163163
disable = false
164+
[[module.mounts]]
165+
source = 'assets'
166+
target = 'assets'
167+
source = 'static'
168+
target = 'assets'
164169

165170
# added the user feedback module
166171
[params.ui.feedback]
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{{- $u := urls.Parse .Destination -}}
2+
{{- $src := $u.String -}}
3+
{{- if not $u.IsAbs -}}
4+
{{- $path := strings.TrimPrefix "./" $u.Path -}}
5+
{{- with or (.PageInner.Resources.Get $path) (resources.Get $path) -}}
6+
{{- $src = .RelPermalink -}}
7+
{{- with $u.RawQuery -}}
8+
{{- $src = printf "%s?%s" $src . -}}
9+
{{- end -}}
10+
{{- with $u.Fragment -}}
11+
{{- $src = printf "%s#%s" $src . -}}
12+
{{- end -}}
13+
{{- end -}}
14+
{{- end -}}
15+
<img src="{{ $src }}" alt="{{ .PlainText }}"
16+
{{- with .Title }} title="{{ . }}" {{- end -}}
17+
{{- range $k, $v := .Attributes -}}
18+
{{- if $v -}}
19+
{{- printf " %s=%q" $k ($v | transform.HTMLEscape) | safeHTMLAttr -}}
20+
{{- end -}}
21+
{{- end -}}
22+
>
23+
{{- /**/ -}}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{{- $u := urls.Parse .Destination -}}
2+
{{- $href := $u.String -}}
3+
{{- if strings.HasPrefix $u.String "#" -}}
4+
{{- $href = printf "%s#%s" .PageInner.RelPermalink $u.Fragment -}}
5+
{{- else if and $href (not $u.IsAbs) -}}
6+
{{- $path := strings.TrimPrefix "./" $u.Path -}}
7+
{{- with or
8+
($.PageInner.GetPage $path)
9+
($.PageInner.Resources.Get $path)
10+
(resources.Get $path)
11+
-}}
12+
{{- $href = .RelPermalink -}}
13+
{{- with $u.RawQuery -}}
14+
{{- $href = printf "%s?%s" $href . -}}
15+
{{- end -}}
16+
{{- with $u.Fragment -}}
17+
{{- $href = printf "%s#%s" $href . -}}
18+
{{- end -}}
19+
{{- end -}}
20+
{{- end -}}
21+
<a href="{{ $href }}" {{- with .Title }} title="{{ . }}" {{- end }}>{{ .Text }}</a>
22+
{{- /**/ -}}

0 commit comments

Comments
 (0)