/
hero.html
118 lines (117 loc) · 4.01 KB
/
hero.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
{{- $self := . -}}
{{- if .Params.particles -}}
{{- .page_scratch.Add "js" (dict "file" "syna-hero.js") -}}
{{- end -}}
{{- $bg := .self.Scratch.Get "bg" }}
{{ "<!-- Hero -->" | safeHTML }}
<header id="{{ .Name }}" class="fragment hero">
{{- if .Params.header }}
<div
style="
{{- with .Params.minHeight -}}
{{- (printf "min-height: %s;" .) | safeCSS -}}
{{- end -}}
background-image:url({{ partial "helpers/image.html" (dict "root" $self "asset" .Params.header) }})"
class="jumbotron text-center header-image mb-0
{{- printf " bg-%s" $bg -}}
">
{{- else }}
<div style="
{{- with .Params.minHeight -}}
{{- (printf "min-height: %s;" .) | safeCSS -}}
{{- end -}}
"class="jumbotron text-center mb-0
{{- printf " bg-%s" $bg -}}
">
{{- end }}
{{- if .Params.particles }}
<div id="{{ printf "%s-particles-js" .Name }}" class="hero-particles particles-js"></div>
{{- end -}}
{{- if .Params.asset -}}
{{- with .Params.asset }}
<div class="hero-image-container row justify-content-center align-items-start">
<img
class="hero-image overlay img-fluid"
src="{{ partial "helpers/image.html" (dict "root" $self "asset" .) }}"
alt="
{{- if .text -}}
{{- print .text -}}
{{- else if $.Params.title_page -}}
{{- print $.root.Title -}}
{{- else -}}
{{- print $.Params.title -}}
{{- end -}}
"
style="
{{- if .height }}height: {{ .height }} !important;{{- end -}}
{{- if .width }}width: {{ .width }} !important;{{- end -}}
"
></img>
</div>
{{- end }}
{{- with .Params.subtitle }}
<div class="hero-subtitle-container row justify-content-center align-items-start">
<h1 class="hero-subtitle overlay jumbotron-heading my-4
{{- partial "helpers/text-color.html" (dict "self" $self.self) -}}
">
{{- . | markdownify -}}
</h1>
</div>
{{- end -}}
{{- else }}
{{- if .Params.title_page }}
<div class="hero-page-title-container row justify-content-center align-items-start">
<h1 class="hero-page-title overlay jumbotron-heading
{{- partial "helpers/text-color.html" (dict "self" $self.self) -}}
">
{{ $.root.Title }}
</h1>
</div>
{{- else -}}
{{- with .Params.title }}
<div class="hero-title-container row justify-content-center align-items-start">
<h1 class="hero-title overlay jumbotron-heading
{{- partial "helpers/text-color.html" (dict "self" $self.self) -}}
">
{{- . -}}
</h1>
</div>
{{- end -}}
{{- end -}}
{{- with .Params.subtitle }}
<div class="hero-subtitle-container row justify-content-center align-items-start">
<div class="hero-subtitle overlay lead
{{- partial "helpers/text-color.html" (dict "self" $self.self) -}}
">
{{- . | markdownify -}}
</div>
</div>
{{- end -}}
{{- end -}}
<div class="hero-buttons">
{{- range .Params.buttons }}
<a class="overlay btn btn-lg m-2
{{- if hasPrefix .url " # " }} anchor{{ end -}}
{{- $color := .color | default "primary" -}}
{{- printf " btn-%s " $color -}}
" href="{{ .url | relLangURL }}">
<div class="column justify-content-center align-content-center">
{{- .text -}}
</div>
</a>
{{- end }}
</div>
</div>
</header>
{{- if .Params.particles }}
{{- if .page.File.Dir -}}
<script>
var fragmentName = "{{ .Name }}";
{{- $file_path := printf "%s%s/config.json" .page.File.Dir .Name -}}
window.syna.api.register("hero", "hero-" + fragmentName, {
selector: "{{ printf "%s-particles-js" .Name }}",
config: {{ if fileExists $file_path -}} JSON.parse({{ readFile $file_path | safeHTML }}) {{- else -}} null {{- end -}},
});
</script>
{{ end -}}
{{ end -}}