Files
2026-05-18 11:46:02 +02:00

179 lines
5.8 KiB
HTML

{{/*This partial is used from
- layouts/shortcodes/experience.html, anywhere via shortcode (commonly in homepage)
- layouts/experience/list.html, in "/experience" page(s))
*/}}
{{- $contextType := printf "%T" . -}}
{{- $isShortcode := (eq $contextType "*hugolib.ShortcodeWithPage") -}}
{{/* ---------------------------------------------------------------------------
INTRO TITLE / DESCRIPTION
--------------------------------------------------------------------------- */}}
{{- /* Intro title/description */}}
{{- $introTitle := "" -}}
{{- $introDescription := "" -}}
{{- if $isShortcode }}
{{/* Shortcode params */}}
{{- $introTitle = .Get "intro_title" | default false -}}
{{- $introDescription = .Get "intro_description" | default ( i18n "experience_description" ) | safeHTML -}}
{{ else }}
{{/* Fallback to the content of the markdown in /experience/_index.md */}}
{{/* Base fields from content */}}
{{- $introTitle = .Title -}}
{{- $introDescription = .Content | safeHTML -}}
{{ end }}
{{/* ---------------------------------------------------------------------------
BUTTON #1
--------------------------------------------------------------------------- */}}
{{- /* Button #1 */}}
{{- $btn1Enable := false -}}
{{- $btn1Icon := "" -}}
{{- $btn1URL := "" -}}
{{- $btn1Text := "" -}}
{{- if $isShortcode }}
{{- $btn1Enable = true -}}
{{- $btn1Icon = .Get "button1_icon" | default .Site.Data.homepage.experience.button.icon -}}
{{- $btn1URL = .Get "button1_url" | default ( i18n "experience_button_url" ) -}}
{{- $btn1Text = .Get "button1_text" | default ( i18n "experience_button" ) -}}
{{ else }}
{{- $btn1Enable = .Site.Data.homepage.experience.button.enable -}}
{{- $btn1Icon = .Site.Data.homepage.experience.button.icon -}}
{{- $btn1URL = i18n "experience_button_url" -}}
{{- $btn1Text = i18n "experience_button" -}}
{{ end }}
{{/* ---------------------------------------------------------------------------
BUTTON #2
--------------------------------------------------------------------------- */}}
{{- /* Button #2 */}}
{{- $btn2Enable := false -}}
{{- $btn2Icon := "" -}}
{{- $btn2URL := "" -}}
{{- $btn2Text := "" -}}
{{- if $isShortcode }}
{{- $btn2Enable = true -}}
{{- $hideViewAll := .Get "hideViewAll" -}}
{{- if eq $hideViewAll "true" -}}
{{- $btn2Enable = false -}}
{{- end -}}
{{- $btn2Icon = .Get "button2_icon" | default .Site.Data.homepage.experience.button2.icon -}}
{{- $btn2URL = .Get "button2_url" | default ( i18n "experience_button2_url" ) -}}
{{- $btn2Text = .Get "button2_text" | default ( i18n "experience_button2" ) -}}
{{ else }}
{{- $btn2Enable = .Site.Data.homepage.experience.button2.enable -}}
{{- $btn2Icon = .Site.Data.homepage.experience.button2.icon -}}
{{- $btn2URL = i18n "experience_button2_url" -}}
{{- $btn2Text = i18n "experience_button2" -}}
{{ end }}
{{/* ---------------------------------------------------------------------------
BUTTON #3
--------------------------------------------------------------------------- */}}
{{- /* Button #3 */}}
{{- $btn3Enable := false -}}
{{- $btn3Icon := "" -}}
{{- $btn3URL := "" -}}
{{- $btn3Text := "" -}}
{{- if $isShortcode }}
{{- $btn3Enable = true -}}
{{- $hideViewAll := .Get "hideViewAll" -}}
{{- if eq $hideViewAll "true" -}}
{{- $btn3Enable = false -}}
{{- end -}}
{{- $btn3Icon = .Get "button3_icon" | default .Site.Data.homepage.experience.button3.icon -}}
{{- $btn3URL = .Get "button3_url" | default ( i18n "experience_button3_url" ) -}}
{{- $btn3Text = .Get "button3_text" | default ( i18n "experience_button3" ) -}}
{{ else }}
{{- $btn3Enable = .Site.Data.homepage.experience.button3.enable -}}
{{- $btn3Icon = .Site.Data.homepage.experience.button3.icon -}}
{{- $btn3URL = i18n "experience_button3_url" -}}
{{- $btn3Text = i18n "experience_button3" -}}
{{ end }}
{{/* Fields from front matter */}}
{{- with .Params.button1_icon }}
{{- $btn1Icon = . -}}
{{ end }}
{{- with .Params.button1_url }}
{{- $btn1URL = . -}}
{{ end }}
{{- with .Params.button1_text }}
{{- $btn1Enable = true -}}
{{- $btn1Text = . -}}
{{ end }}
{{- with .Params.button2_icon }}
{{- $btn2Icon = . -}}
{{ end }}
{{- with .Params.button2_url }}
{{- $btn2URL = . -}}
{{ end }}
{{- with .Params.button2_text }}
{{- $btn2Enable = true -}}
{{- $btn2Text = . -}}
{{ end }}
{{- with .Params.button3_icon }}
{{- $btn3Icon = . -}}
{{ end }}
{{- with .Params.button3_url }}
{{- $btn3URL = . -}}
{{ end }}
{{- with .Params.button3_text }}
{{- $btn3Enable = true -}}
{{- $btn3Text = . -}}
{{ end }}
<div class="container-experience">
<div class="row">
<h2>{{ $introTitle }}</h2>
<div class="lead">{{ $introDescription }}</div>
</div>
<div class="row">
{{ if $btn1Enable }}
<div class="col-12 col-lg-4">
<a
href='{{ $btn1URL | absURL }}'
class="btn btn-primary btn-block w-100"
target="_blank"
rel="noopener noreferrer"
>
{{ if $btn1Icon }}<i class="{{ $btn1Icon }}"></i>{{ end }}
{{ $btn1Text }}
<i class="icon-arrow-right"></i>
</a>
</div>
{{ end }}
{{ if $btn2Enable }}
<div class="col-12 col-lg-4">
<a
href='{{ $btn2URL | absURL }}'
class="btn btn-frameless w-100"
target="_blank"
rel="noopener noreferrer"
>
{{ if $btn2Icon }}<i class="{{ $btn2Icon }}"></i>{{ end }}
{{ $btn2Text }}
</a>
</div>
{{ end }}
{{ if $btn3Enable }}
<div class="col-12 col-lg-4">
<a
href='{{ $btn3URL | absURL }}'
class="btn btn-frameless w-100"
rel="noopener noreferrer"
>
{{ if $btn3Icon }}<i class="{{ $btn3Icon }}"></i>{{ end }}
{{ $btn3Text }}
</a>
</div>
{{ end }}
</div>
</div>