Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only apply the absURL on images served through satic directory #557

Merged
merged 1 commit into from
Jun 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion layouts/_default/summary-with-image.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}">
Expand Down
4 changes: 3 additions & 1 deletion layouts/partials/func/GetFeaturedImage.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
1 change: 0 additions & 1 deletion layouts/partials/page-header.html
Original file line number Diff line number Diff line change
@@ -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" . }}
Expand Down
1 change: 0 additions & 1 deletion layouts/partials/site-header.html
Original file line number Diff line number Diff line change
@@ -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" .}}
Expand Down
1 change: 0 additions & 1 deletion layouts/partials/summary-with-image.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,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 }}">
Expand Down