From 24a09c86e76a13146bfaaaec58297420ad3eac6e Mon Sep 17 00:00:00 2001 From: Matt Farina Date: Mon, 17 May 2021 16:46:23 -0400 Subject: [PATCH] Make the link template handle abs and other domain urls Signed-off-by: Matt Farina --- content/blog/.DS_Store | Bin 6148 -> 6148 bytes layouts/_default/_markup/render-image.html | 12 +++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/content/blog/.DS_Store b/content/blog/.DS_Store index 8b22932acfc985876d23ac0ae7689f73e3e9f71b..903eaa8ac4ec27d6722448458a8f511a3269aecc 100644 GIT binary patch delta 98 zcmZoMXffE}$;5bkvKLc>yI6I#fsTTinPIJtLbbU$kZodYR$I%-A+Bm@>zR;SSyf$A hTQ{8n3>X<9Gy^}BhEX#n`!gGDc4I!svY3TK005r36iEO8 delta 72 zcmZoMXffE}$;5bSvKLc>mSlCcp@FfHj)H};d998@wYj;0j)IA?S#2#Rhq$Vtt!F}R cWmR=eZQZQNADQGCXKxl{{>-wOo#QV*00$KoT>t<8 diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html index 41c87b2..ef90695 100644 --- a/layouts/_default/_markup/render-image.html +++ b/layouts/_default/_markup/render-image.html @@ -1 +1,11 @@ -{{ . }} \ No newline at end of file +{{ $dest := .Destination -}} +{{ $url := urls.Parse .Destination -}} +{{ if eq $url.Host "" -}} + {{ if hasPrefix $url.Path "/" -}} + {{ $base := strings.TrimSuffix "/" .Page.Site.BaseURL -}} + {{ $dest = printf "%s%s" $base .Destination -}} + {{ else -}} + {{ $dest = printf "%s%s" .Page.Permalink .Destination -}} + {{ end -}} +{{ end -}} +{{ . }} \ No newline at end of file