mirror of https://github.com/theNewDynamic/gohugo-theme-ananke.git

Bud Parr
19.45.2017 ee265de976880f7cb08b30c431d0e081849d0ba9
improve image handling for edge cases Fixes #11
3 files modified
17 ■■■■ changed files
layouts/partials/page-header.html 6 ●●●●● patch | view | raw | blame | history
layouts/partials/site-header.html 6 ●●●●● patch | view | raw | blame | history
layouts/partials/summary-with-image.html 5 ●●●● patch | view | raw | blame | history
layouts/partials/page-header.html
@@ -1,6 +1,8 @@
{{ $featured_image := $.Param "featured_image" }}
{{ $featured_image := .Params.featured_image }}
{{ if $featured_image }}
  <header class="cover bg-center" style="background-image: url('{{ $featured_image | absURL }}');">
  {{/* 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-center" style="background-image: url('{{ $featured_image }}');">
    <div class="pb3-m pb6-l bg-black-60">
      {{ partial "site-navigation.html" . }}
      <div class="tc-l pv6 ph3 ph4-ns">
layouts/partials/site-header.html
@@ -1,6 +1,8 @@
{{ $featured_image := $.Param "featured_image" }}
{{ $featured_image := .Params.featured_image | default .Site.Params.featured_image }}
{{ if $featured_image }}
  <header class="cover bg-center" style="background-image: url('{{ $featured_image | absURL }}');">
  {{/* 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-center" style="background-image: url('{{ $featured_image }}');">
    <div class="bg-black-60">
      {{ partial "site-navigation.html" .}}
      <div class="tc-l pv4 pv6-l ph3 ph4-ns">
layouts/partials/summary-with-image.html
@@ -1,9 +1,12 @@
{{ $featured_image := .Params.featured_image }}
<article class="bb b--black-10">
  <a class="db pv4 ph3 ph0-l no-underline dark-gray dim" href="{{ .URL }}">
    <div class="flex flex-column flex-row-ns">
      {{ if .Params.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="pr3-ns mb4 mb0-ns w-100 w-40-ns">
          <img src="{{ .Params.featured_image }}" class="db" alt="image from {{ .Title }}">
          <img src="{{ $featured_image }}" class="db" alt="image from {{ .Title }}">
        </div>
      {{ end }}
      <div class="w-100{{ if .Params.featured_image }} w-60-ns pl3-ns{{ end }}">