Skip to content

Commit 7849804

Browse files
authored
Merge pull request #200 from spinkube/remove-image-cover-h1
remove the logo_image from block / cover
2 parents 52232f2 + 67a8ced commit 7849804

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{{ $_hugo_config := `{ "version": 1 }` -}}
2+
{{ $blockID := printf "td-cover-block-%d" .Ordinal -}}
3+
{{ $promo_image := (.Page.Resources.ByType "image").GetMatch "**background*" -}}
4+
{{ $logo_image := (.Page.Resources.ByType "image").GetMatch "**logo*" -}}
5+
{{ $col_id := .Get "color" | default "dark" -}}
6+
{{ $image_anchor := .Get "image_anchor" | default "smart" -}}
7+
{{ $logo_anchor := .Get "logo_anchor" | default "smart" -}}
8+
{{/* Height can be one of: auto, min, med, max, full. */ -}}
9+
{{ $height := .Get "height" | default "max" -}}
10+
11+
{{ with $promo_image -}}
12+
{{ $promo_image_big := . -}}
13+
{{ $promo_image_small := . -}}
14+
{{ if ne $promo_image.MediaType.SubType "svg" -}}
15+
{{ $promo_image_big = .Fill (printf "1920x1080 %s" $image_anchor) -}}
16+
{{ $promo_image_small = .Fill (printf "960x540 %s" $image_anchor) -}}
17+
{{ end -}}
18+
<link rel="preload" as="image" href="{{ $promo_image_small.RelPermalink }}" media="(max-width: 1200px)">
19+
<link rel="preload" as="image" href="{{ $promo_image_big.RelPermalink }}" media="(min-width: 1200px)">
20+
<style>
21+
#{{ $blockID }} {
22+
background-image: url({{ $promo_image_small.RelPermalink }});
23+
}
24+
@media only screen and (min-width: 1200px) {
25+
#{{ $blockID }} {
26+
background-image: url({{ $promo_image_big.RelPermalink }});
27+
}
28+
}
29+
</style>
30+
{{ end -}}
31+
32+
<section id="{{ $blockID }}" class="row td-cover-block td-cover-block--height-{{ $height -}}
33+
{{ if not .Site.Params.ui.navbar_translucent_over_cover_disable }} js-td-cover
34+
{{- end }} td-overlay td-overlay--dark -bg-{{ $col_id }}">
35+
<div class="col-12">
36+
<div class="container td-overlay__inner">
37+
<div class="text-center">
38+
{{ with .Get "title" }}<h1 class="display-1 mt-0 mt-md-5 pb-4">{{ $title := . }}{{ $title | html }}</h1>{{ end }}
39+
{{ with .Get "subtitle" }}<p class="display-2 text-uppercase mb-0">{{ . | html }}</p>{{ end }}
40+
<div class="pt-3 lead">
41+
{{ if eq .Page.File.Ext "md" }}
42+
{{ .Inner | markdownify }}
43+
{{ else }}
44+
{{ .Inner | htmlUnescape | safeHTML }}
45+
{{ end }}
46+
</div>
47+
</div>
48+
</div>
49+
</div>
50+
{{ with .Get "byline" | default "" -}}
51+
<div class="byline">{{ . }}</div>
52+
{{- end }}
53+
</section>
54+
{{/**/ -}}

0 commit comments

Comments
 (0)