Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/pravin/hugo-theme-prav.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeon Rosenshein <leonrosn@amazon.com>2022-05-20 19:00:16 +0300
committerLeon Rosenshein <leonrosn@amazon.com>2022-05-20 19:00:16 +0300
commit6aaeb3d4655e6854ac66a8a18ec886e0f52bb203 (patch)
treeaad4cabc25365fb51af5c0e598ba799eaff28034
parentc3fd9cd9c7862ffd5c1ab3fbc7176c66b917df75 (diff)
Relative paths for preview images
-rw-r--r--layouts/partials/header.html9
1 files changed, 8 insertions, 1 deletions
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
index 442fffe..3fb6ff4 100644
--- a/layouts/partials/header.html
+++ b/layouts/partials/header.html
@@ -52,6 +52,13 @@
{{$imageLink = .Site.Params.authorImgPath -}}
{{ end -}}
+ <!-- This block handles relative paths to the preview image -->
+ {{- if .File.Dir -}}
+ {{ if not (hasPrefix $imageLink "/") -}}
+ {{ $imageLink = path.Join .File.Dir $imageLink -}}
+ {{ end -}}
+ {{ end -}}
+
{{ "<!-- OpenGraph/Twitter Specific Stuff-->" | safeHTML }}
<meta name="twitter:card" content="summary">
<meta property=”og:type” content=”blog”>
@@ -71,4 +78,4 @@
{{ partial "custom_header.html" . }}
{{ template "_internal/google_analytics.html" . }}
-</head>
+</head> \ No newline at end of file