From da42e92238ce323aafc3f7020a385768c32f5f58 Mon Sep 17 00:00:00 2001 From: mtail Date: Thu, 31 May 2018 10:32:50 -0700 Subject: [PATCH] Turn image URls into absolute references so they work consistently with page URLS with or without a trailing / --- .../index.md => egress-https.md} | 2 +- .../2018/egress-https/bookinfo-details-v2.svg | 1589 ----------------- layouts/shortcodes/image.html | 15 + 3 files changed, 16 insertions(+), 1590 deletions(-) rename content/blog/2018/{egress-https/index.md => egress-https.md} (99%) delete mode 100644 content/blog/2018/egress-https/bookinfo-details-v2.svg diff --git a/content/blog/2018/egress-https/index.md b/content/blog/2018/egress-https.md similarity index 99% rename from content/blog/2018/egress-https/index.md rename to content/blog/2018/egress-https.md index 2f673d2fc6..a556438a47 100644 --- a/content/blog/2018/egress-https/index.md +++ b/content/blog/2018/egress-https.md @@ -40,7 +40,7 @@ $ kubectl apply -f <(istioctl kube-inject -f samples/bookinfo/kube/bookinfo-deta The updated architecture of the application now looks as follows: {{< image width="80%" ratio="65.16%" - link="bookinfo-details-v2.svg" + link="../img/bookinfo-details-v2.svg" caption="The Bookinfo Application with details V2" >}} diff --git a/content/blog/2018/egress-https/bookinfo-details-v2.svg b/content/blog/2018/egress-https/bookinfo-details-v2.svg deleted file mode 100644 index 483424a055..0000000000 --- a/content/blog/2018/egress-https/bookinfo-details-v2.svg +++ /dev/null @@ -1,1589 +0,0 @@ - - - - Istio Bookinfo Sample Application - - - - image/svg+xml - - Istio Bookinfo Sample Application - - - - Shriram Rajagopalan - - - - - Istio - Microservice Fabric - Service Mesh - Envoy - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Ratings - - - - Details-v1 - - - - - - - - - - - - - - - - - - - Ruby - - - - Product - page - - - - - - - - - - - Ingress Envoy - - - - - Reviews-v3 - - - - - - - - - - Reviews-v2 - - - - - - - - - - - Reviews-v1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Requests - - - - - - - - - - - Envoy - - - - - - - - - - - - Details-v2 - - - - - Istio Service Mesh - Google - Books - APIs - - - - diff --git a/layouts/shortcodes/image.html b/layouts/shortcodes/image.html index eb9a562a0c..2d80c92ff3 100644 --- a/layouts/shortcodes/image.html +++ b/layouts/shortcodes/image.html @@ -31,6 +31,21 @@ parameter. {{ $title := or (.Get "title") (.Get "caption") }} {{ $alt := or (.Get "alt") (.Get "title") (.Get "caption") }} +{{/* Turn relative values for $link into absolute URLs */}} +{{ $prefix := slicestr $link 0 1 }} +{{ if (eq $prefix "/") }} + {{ .Scratch.Set "link" $link }} +{{ else }} + {{ $prefix := slicestr $link 0 3 }} + {{ if (eq $prefix "../") }} + {{ $link := slicestr $link 3 }} + {{ .Scratch.Set "link" (printf "/%s%s" .Page.Dir $link) }} + {{ else }} + {{ .Scratch.Set "link" (printf "/%s%s" .Page.Dir $link) }} + {{ end }} +{{ end }} +{{ $link := printf "%s%s" .Site.BaseURL (.Scratch.Get "link") }} +