Only apply the absURL on images served through satic directory (#557)
This will solve the subdirectory edge case without communication Fixes #556
This commit is contained in:
parent
720bd45dc8
commit
470ea40982
|
@ -4,7 +4,6 @@
|
||||||
<div class="flex flex-column flex-row-ns">
|
<div class="flex flex-column flex-row-ns">
|
||||||
{{ if $featured_image }}
|
{{ if $featured_image }}
|
||||||
{{/* Trimming the slash and adding absURL make sure the image works no matter where our site lives */}}
|
{{/* 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">
|
<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">
|
<a href="{{.RelPermalink}}" class="db grow">
|
||||||
<img src="{{ $featured_image }}" class="img" alt="image from {{ .Title }}">
|
<img src="{{ $featured_image }}" class="img" alt="image from {{ .Title }}">
|
||||||
|
|
|
@ -20,7 +20,9 @@
|
||||||
{{ $matches := "feature,cover" }}
|
{{ $matches := "feature,cover" }}
|
||||||
{{/* Use the value from front matter if present */}}
|
{{/* Use the value from front matter if present */}}
|
||||||
{{ with .Params.featured_image }}
|
{{ 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. */}}
|
{{/* If we find a Page Resource matching the exact value, we use it instead. */}}
|
||||||
{{ with $.Resources.GetMatch . }}
|
{{ with $.Resources.GetMatch . }}
|
||||||
{{ $linkToCover = .RelPermalink }}
|
{{ $linkToCover = .RelPermalink }}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
{{ $featured_image := partial "func/GetFeaturedImage.html" . }}
|
{{ $featured_image := partial "func/GetFeaturedImage.html" . }}
|
||||||
{{ if $featured_image }}
|
{{ if $featured_image }}
|
||||||
{{/* Trimming the slash and adding absURL make sure the image works no matter where our site lives */}}
|
{{/* 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 }}');">
|
<header class="cover bg-top" style="background-image: url('{{ $featured_image }}');">
|
||||||
<div class="bg-black-60">
|
<div class="bg-black-60">
|
||||||
{{ partial "site-navigation.html" . }}
|
{{ partial "site-navigation.html" . }}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
{{ $featured_image := partial "func/GetFeaturedImage.html" . }}
|
{{ $featured_image := partial "func/GetFeaturedImage.html" . }}
|
||||||
{{ if $featured_image }}
|
{{ if $featured_image }}
|
||||||
{{/* Trimming the slash and adding absURL make sure the image works no matter where our site lives */}}
|
{{/* 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 }}');">
|
<header class="cover bg-top" style="background-image: url('{{ $featured_image }}');">
|
||||||
<div class="{{ .Site.Params.cover_dimming_class | default "bg-black-60" }}">
|
<div class="{{ .Site.Params.cover_dimming_class | default "bg-black-60" }}">
|
||||||
{{ partial "site-navigation.html" .}}
|
{{ partial "site-navigation.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">
|
<div class="flex flex-column flex-row-ns">
|
||||||
{{ if $featured_image }}
|
{{ if $featured_image }}
|
||||||
{{/* Trimming the slash and adding absURL make sure the image works no matter where our site lives */}}
|
{{/* 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">
|
<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">
|
<a href="{{.RelPermalink}}" class="db grow">
|
||||||
<img src="{{ $featured_image }}" class="img" alt="image from {{ .Title }}">
|
<img src="{{ $featured_image }}" class="img" alt="image from {{ .Title }}">
|
||||||
|
|
Loading…
Reference in a new issue