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

github.com/budparr/gohugo-theme-ananke.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRegis Philibert <login@regisphilibert.com>2022-06-10 22:36:57 +0300
committerGitHub <noreply@github.com>2022-06-10 22:36:57 +0300
commit470ea40982f5036554819253c3ac6ed4a34193f4 (patch)
treea7d17c6378880927d42611b95d3d612628cf7f2d
parent720bd45dc839cb58d27f8a256583e83f1395b955 (diff)
Only apply the absURL on images served through satic directory (#557)v2.9.1
This will solve the subdirectory edge case without communication Fixes #556
-rw-r--r--layouts/_default/summary-with-image.html1
-rw-r--r--layouts/partials/func/GetFeaturedImage.html4
-rw-r--r--layouts/partials/page-header.html1
-rwxr-xr-xlayouts/partials/site-header.html1
-rw-r--r--layouts/partials/summary-with-image.html1
5 files changed, 3 insertions, 5 deletions
diff --git a/layouts/_default/summary-with-image.html b/layouts/_default/summary-with-image.html
index 3c94240..0467891 100644
--- a/layouts/_default/summary-with-image.html
+++ b/layouts/_default/summary-with-image.html
@@ -4,7 +4,6 @@
<div class="flex flex-column flex-row-ns">
{{ if $featured_image }}
{{/* Trimming the slash and adding absURL make sure the image works no matter where our site lives */}}
- {{ $featured_image := (trim $featured_image "/") | absURL }}
<div class="{{ cond (eq $.Site.Language.LanguageDirection "rtl") "pl3-ns" "pr3-ns" }} mb4 mb0-ns w-100 w-40-ns">
<a href="{{.RelPermalink}}" class="db grow">
<img src="{{ $featured_image }}" class="img" alt="image from {{ .Title }}">
diff --git a/layouts/partials/func/GetFeaturedImage.html b/layouts/partials/func/GetFeaturedImage.html
index 12ffe1c..8d250c7 100644
--- a/layouts/partials/func/GetFeaturedImage.html
+++ b/layouts/partials/func/GetFeaturedImage.html
@@ -20,7 +20,9 @@
{{ $matches := "feature,cover" }}
{{/* Use the value from front matter if present */}}
{{ with .Params.featured_image }}
- {{ $linkToCover = . }}
+ {{/* This is the default case, the image lives in the static directory.
+ In which case we'll use the static dir */}}
+ {{ $linkToCover = trim . "/" | absURL }}
{{/* If we find a Page Resource matching the exact value, we use it instead. */}}
{{ with $.Resources.GetMatch . }}
{{ $linkToCover = .RelPermalink }}
diff --git a/layouts/partials/page-header.html b/layouts/partials/page-header.html
index 9e46054..8fbaea3 100644
--- a/layouts/partials/page-header.html
+++ b/layouts/partials/page-header.html
@@ -1,7 +1,6 @@
{{ $featured_image := partial "func/GetFeaturedImage.html" . }}
{{ if $featured_image }}
{{/* Trimming the slash and adding absURL make sure the image works no matter where our site lives */}}
- {{ $featured_image := (trim $featured_image "/") | absURL }}
<header class="cover bg-top" style="background-image: url('{{ $featured_image }}');">
<div class="bg-black-60">
{{ partial "site-navigation.html" . }}
diff --git a/layouts/partials/site-header.html b/layouts/partials/site-header.html
index aad8749..1a0b3cb 100755
--- a/layouts/partials/site-header.html
+++ b/layouts/partials/site-header.html
@@ -1,7 +1,6 @@
{{ $featured_image := partial "func/GetFeaturedImage.html" . }}
{{ if $featured_image }}
{{/* Trimming the slash and adding absURL make sure the image works no matter where our site lives */}}
- {{ $featured_image := (trim $featured_image "/") | absURL }}
<header class="cover bg-top" style="background-image: url('{{ $featured_image }}');">
<div class="{{ .Site.Params.cover_dimming_class | default "bg-black-60" }}">
{{ partial "site-navigation.html" .}}
diff --git a/layouts/partials/summary-with-image.html b/layouts/partials/summary-with-image.html
index dbc2760..f16556e 100644
--- a/layouts/partials/summary-with-image.html
+++ b/layouts/partials/summary-with-image.html
@@ -7,7 +7,6 @@ More info here: https://github.com/theNewDynamic/gohugo-theme-ananke/releases/ta
<div class="flex flex-column flex-row-ns">
{{ if $featured_image }}
{{/* Trimming the slash and adding absURL make sure the image works no matter where our site lives */}}
- {{ $featured_image := (trim $featured_image "/") | absURL }}
<div class="{{ cond (eq $.Site.Language.LanguageDirection "rtl") "pl3-ns" "pr3-ns" }} mb4 mb0-ns w-100 w-40-ns">
<a href="{{.RelPermalink}}" class="db grow">
<img src="{{ $featured_image }}" class="img" alt="image from {{ .Title }}">