Dirty hack to add summary img as hero background

master
Quentin Duchemin 2021-05-27 01:06:32 +02:00
parent a73ab8bed5
commit e089d4b02a
2 changed files with 9 additions and 3 deletions

View File

@ -7,8 +7,14 @@
<link rel="stylesheet" href="{{ $styleCustom.Permalink }}">
<!-- tbh I am too lazy to extend Bulma, so put dirty CSS directives here to be able to use Hugo templating system -->
<style>
{{ $bg := resources.Get "img/hero_home.png" }}
.has-bg-img { background: url('{{ $bg.Permalink }}')center center; background-size:cover; }
/* Default to home image */
{{ $image := resources.Get "img/hero_home.png" }}
{{ $imageURL := $image.Permalink }}
/* If header image exists in current context, use it instead */
{{ with .Resources.GetMatch "top.jpg" }}
{{ $imageURL = .Permalink }}
{{ end }}
.has-bg-img { background: url('{{ $imageURL }}')center center; background-size:cover; }
</style>
<!-- Favico -->
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">

View File

@ -1,5 +1,5 @@
<header>
<section class="hero is-primary has-text-centered is-medium">
<section class="hero has-bg-img is-primary has-text-centered is-large">
<div class="hero-head mx-5">
<div class="level subtitle is-5">
<div class="level-left">