We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f8ac8b5 commit 793f4c3Copy full SHA for 793f4c3
hugo-modules/core/utils/get-abs-url.html
@@ -0,0 +1,18 @@
1
+{{/*
2
+ utils/get-abs-url
3
+ Returns an absolute URL with forced https prototol.
4
+
5
+ @returns Sring
6
7
+ @example - Go Template
8
+ {{ partial "utils/get-abs-url" .url }}
9
+*/}}
10
+{{ $url := . }}
11
12
+{{/* Creates an absolute URL based on the configured baseURL. */}}
13
+{{ $url = . | absURL }}
14
15
+{{/* Adds https prototcol if the url starts with // and is not localhost */}}
16
+{{ $url = cond (and (hasPrefix $url "//") (not (hasPrefix $url "//localhost"))) (print "https:" $url) $url }}
17
18
+{{ return $url }}
0 commit comments