mirror of
https://github.com/tiennm99/HugoBlox-kit.git
synced 2026-10-13 10:15:22 +00:00
feat: standardise blocks
- rename widgets/ folder to blocks/ - rename Blank block to Markdown - rename Pages block to Collection - replace Featured block with Collection block, filtered with `featured_only: true` - standardise block variables to .wcPage and .wcBlock - check requested block exists before loading - refactor block parser to parse_block.html
This commit is contained in:
1 parent
537ba53461
commit
39a618761a
17 files changed
+368
-386
No files matched your search
+11
-6
@@ -1,17 +1,22 @@
|
||||
{{ $ := .root }}
|
||||
{{ $page := .page }}
|
||||
{{/* Wowchemy Blocks: About - avatar variation */}}
|
||||
{{/* Documentation: https://wowchemy.com/blocks/ */}}
|
||||
{{/* License: https://github.com/wowchemy/wowchemy-hugo-themes/blob/main/LICENSE.md */}}
|
||||
|
||||
{{/* Initialise */}}
|
||||
{{ $page := .wcPage }}
|
||||
{{ $block := .wcBlock }}
|
||||
|
||||
{{ $author := "" }}
|
||||
{{ if .author }}
|
||||
{{ $author = .author }}
|
||||
{{ $author = .author }}
|
||||
{{ else }}
|
||||
{{ $author = $page.Params.author }}
|
||||
{{ $author = $block.Params.author }}
|
||||
{{end}}
|
||||
|
||||
{{ $person_page_path := (printf "/authors/%s" $author) }}
|
||||
{{ $person_page := site.GetPage $person_page_path }}
|
||||
{{ if not $person_page }}
|
||||
{{ errorf "Could not find an author page at `%s`. Please check the value of `author` in your About widget and create an associated author page if one does not already exist. See https://wowchemy.com/docs/page-builder/#about " $person_page_path }}
|
||||
{{ errorf "Could not find an author page at `%s`. Please check the value of `author` in your About widget and create an associated author page if one does not already exist. See https://wowchemy.com/docs/page-builder/#about " $person_page_path }}
|
||||
{{end}}
|
||||
{{ $person := $person_page.Params }}
|
||||
{{ $avatar := ($person_page.Resources.ByType "image").GetMatch "*avatar*" }}
|
||||
@@ -77,7 +82,7 @@
|
||||
{{ end }}
|
||||
</ul>
|
||||
|
||||
{{ with $page.Content }}
|
||||
{{ with $block.Content }}
|
||||
<div class="article-style pt-1">
|
||||
{{ . }}
|
||||
</div>
|
||||
+9
-4
@@ -1,11 +1,16 @@
|
||||
{{ $ := .root }}
|
||||
{{ $page := .page }}
|
||||
{{/* Wowchemy Blocks: About */}}
|
||||
{{/* Documentation: https://wowchemy.com/blocks/ */}}
|
||||
{{/* License: https://github.com/wowchemy/wowchemy-hugo-themes/blob/main/LICENSE.md */}}
|
||||
|
||||
{{/* Initialise */}}
|
||||
{{ $page := .wcPage }}
|
||||
{{ $block := .wcBlock }}
|
||||
|
||||
{{ $author := "" }}
|
||||
{{ if .author }}
|
||||
{{ $author = .author }}
|
||||
{{ else }}
|
||||
{{ $author = $page.Params.author }}
|
||||
{{ $author = $block.Params.author }}
|
||||
{{end}}
|
||||
|
||||
{{ $person_page_path := (printf "/authors/%s" $author) }}
|
||||
@@ -83,7 +88,7 @@
|
||||
<div class="col-12 col-lg-8">
|
||||
|
||||
{{/* Only display widget title in explicit instances of about widget, not in author pages. */}}
|
||||
{{ if and $page.Params.widget $page.Title }}<h1>{{ $page.Title | markdownify | emojify }}</h1>{{ end }}
|
||||
{{ if and $block.Params.widget $block.Title }}<h1>{{ $block.Title | markdownify | emojify }}</h1>{{ end }}
|
||||
|
||||
<div class="article-style">
|
||||
{{ $person_page.Content }}
|
||||
+13
-8
@@ -1,13 +1,18 @@
|
||||
{{ $ := .root }}
|
||||
{{ $page := .page }}
|
||||
{{ $columns := $page.Params.design.columns | default "2" }}
|
||||
{{/* Wowchemy Blocks: Accomplishments */}}
|
||||
{{/* Documentation: https://wowchemy.com/blocks/ */}}
|
||||
{{/* License: https://github.com/wowchemy/wowchemy-hugo-themes/blob/main/LICENSE.md */}}
|
||||
|
||||
{{/* Initialise */}}
|
||||
{{ $page := .wcPage }}
|
||||
{{ $block := .wcBlock }}
|
||||
{{ $columns := $block.Params.design.columns | default "2" }}
|
||||
|
||||
<!-- Accomplishments widget -->
|
||||
<div class="col-12 {{if eq $columns "2"}}col-lg-8{{end}}">
|
||||
{{ with $page.Content }}{{ . }}{{ end }}
|
||||
{{ with $block.Content }}{{ . }}{{ end }}
|
||||
|
||||
{{ if $page.Params.item }}
|
||||
{{ range $idx, $key := sort $page.Params.item ".date_start" "desc" }}
|
||||
{{ if $block.Params.item }}
|
||||
{{ range $idx, $key := sort $block.Params.item ".date_start" "desc" }}
|
||||
<div class="card experience course">
|
||||
<div class="card-body">
|
||||
{{- $svg_icon := resources.Get (printf "media/icons/brands/%s.svg" (replace (lower .organization) " " "_")) -}}
|
||||
@@ -32,9 +37,9 @@
|
||||
|
||||
<span class="middot-divider"></span>
|
||||
|
||||
{{ (time .date_start) | time.Format ($page.Params.date_format | default "Jan 2006") }}
|
||||
{{ (time .date_start) | time.Format ($block.Params.date_format | default "Jan 2006") }}
|
||||
{{ if .date_end}}
|
||||
– {{ (time .date_end) | time.Format ($page.Params.date_format | default "Jan 2006") }}
|
||||
– {{ (time .date_end) | time.Format ($block.Params.date_format | default "Jan 2006") }}
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
+35
-31
@@ -1,12 +1,13 @@
|
||||
{{/* Pages Widget */}}
|
||||
{{/* https://wowchemy.com/docs/widget/ */}}
|
||||
{{/* Wowchemy Blocks: Collection */}}
|
||||
{{/* Documentation: https://wowchemy.com/blocks/ */}}
|
||||
{{/* License: https://github.com/wowchemy/wowchemy-hugo-themes/blob/main/LICENSE.md */}}
|
||||
|
||||
{{/* Initialise */}}
|
||||
{{ $ := .root }}
|
||||
{{ $st := .page }}
|
||||
{{ $page := .wcPage }}
|
||||
{{ $block := .wcBlock }}
|
||||
|
||||
{{ $items_offset := $st.Params.content.offset | default 0 }}
|
||||
{{ $items_count := $st.Params.content.count }}
|
||||
{{ $items_offset := $block.Params.content.offset | default 0 }}
|
||||
{{ $items_count := $block.Params.content.count }}
|
||||
{{ if eq $items_count 0 }}
|
||||
{{ $items_count = 65535 }}
|
||||
{{ else }}
|
||||
@@ -18,48 +19,51 @@
|
||||
{{ $archive_page := "" }}
|
||||
|
||||
{{/* Filters */}}
|
||||
{{ if $st.Params.content.page_type }}
|
||||
{{ $query = where $query "Type" $st.Params.content.page_type }}
|
||||
{{ $archive_page = site.GetPage "Section" $st.Params.content.page_type }}
|
||||
{{ if $block.Params.content.page_type }}
|
||||
{{ $query = where $query "Type" $block.Params.content.page_type }}
|
||||
{{ $archive_page = site.GetPage "Section" $block.Params.content.page_type }}
|
||||
{{ end }}
|
||||
{{ if $st.Params.content.filters.folders }}
|
||||
{{ $folders := $st.Params.content.filters.folders }}
|
||||
{{ if $block.Params.content.filters.folders }}
|
||||
{{ $folders := $block.Params.content.filters.folders }}
|
||||
{{ $query = where $query "Section" "in" $folders }}
|
||||
{{/* Init archive page to main folder */}}
|
||||
{{ $main_folder := index $folders 0 }}
|
||||
{{ $archive_page = site.GetPage "Section" $main_folder }}
|
||||
{{ end }}
|
||||
{{ if $st.Params.content.filters.tag }}
|
||||
{{ $archive_page = site.GetPage (printf "tags/%s" (urlize $st.Params.content.filters.tag)) }}
|
||||
{{ if $block.Params.content.filters.tag }}
|
||||
{{ $archive_page = site.GetPage (printf "tags/%s" (urlize $block.Params.content.filters.tag)) }}
|
||||
{{ $query = $query | intersect $archive_page.Pages }}
|
||||
{{ end }}
|
||||
{{ if $st.Params.content.filters.category }}
|
||||
{{ $archive_page = site.GetPage (printf "categories/%s" (urlize $st.Params.content.filters.category)) }}
|
||||
{{ if $block.Params.content.filters.category }}
|
||||
{{ $archive_page = site.GetPage (printf "categories/%s" (urlize $block.Params.content.filters.category)) }}
|
||||
{{ $query = $query | intersect $archive_page.Pages }}
|
||||
{{ end }}
|
||||
{{ if $st.Params.content.filters.publication_type }}
|
||||
{{ $archive_page = site.GetPage (printf "publication_types/%s" $st.Params.content.filters.publication_type) }}
|
||||
{{ if $block.Params.content.filters.publication_type }}
|
||||
{{ $archive_page = site.GetPage (printf "publication_types/%s" $block.Params.content.filters.publication_type) }}
|
||||
{{ $query = $query | intersect $archive_page.Pages }}
|
||||
{{ end }}
|
||||
{{ if $st.Params.content.filters.author }}
|
||||
{{ $archive_page = site.GetPage (printf "authors/%s" (urlize $st.Params.content.filters.author)) }}
|
||||
{{ if $block.Params.content.filters.author }}
|
||||
{{ $archive_page = site.GetPage (printf "authors/%s" (urlize $block.Params.content.filters.author)) }}
|
||||
{{ $query = $query | intersect $archive_page.Pages }}
|
||||
{{ end }}
|
||||
{{ if $st.Params.content.filters.exclude_featured }}
|
||||
{{ if $block.Params.content.filters.featured_only }}
|
||||
{{ $query = where $query "Params.featured" "==" true }}
|
||||
{{ end }}
|
||||
{{ if $block.Params.content.filters.exclude_featured }}
|
||||
{{ $query = where $query "Params.featured" "!=" true }}
|
||||
{{ end }}
|
||||
{{ if $st.Params.content.filters.exclude_past }}
|
||||
{{ if $block.Params.content.filters.exclude_past }}
|
||||
{{ $query = where $query "Date" ">=" now }}
|
||||
{{ end }}
|
||||
{{ if $st.Params.content.filters.exclude_future }}
|
||||
{{ if $block.Params.content.filters.exclude_future }}
|
||||
{{ $query = where $query "Date" "<" now }}
|
||||
{{ end }}
|
||||
|
||||
{{ $count := len $query }}
|
||||
|
||||
{{/* Sort */}}
|
||||
{{ $sort_by := $st.Params.content.sort_by | default "Date" }}
|
||||
{{ $sort_ascending := $st.Params.content.sort_ascending | default (eq $st.Params.content.order "asc") | default false }}
|
||||
{{ $sort_by := $block.Params.content.sort_by | default "Date" }}
|
||||
{{ $sort_ascending := $block.Params.content.sort_ascending | default (eq $block.Params.content.order "asc") | default false }}
|
||||
{{ $sort_order := cond $sort_ascending "asc" "desc" }}
|
||||
{{ $query = sort $query $sort_by $sort_order }}
|
||||
|
||||
@@ -70,23 +74,23 @@
|
||||
{{ $query = first $items_count $query }}
|
||||
{{ end }}
|
||||
|
||||
{{ $columns := $st.Params.design.columns | default "2" }}
|
||||
{{ $columns := $block.Params.design.columns | default "2" }}
|
||||
|
||||
<div class="col-12 {{if eq $columns "2"}}col-lg-8{{end}}">
|
||||
|
||||
{{ with $st.Content }}{{ . }}{{ end }}
|
||||
{{ with $block.Content }}{{ . }}{{ end }}
|
||||
|
||||
{{ range $index, $item := $query }}
|
||||
{{ partial "functions/render_view" (dict "page" $st "item" . "view" ($st.Params.design.view | default "compact") "index" $index) }}
|
||||
{{ partial "functions/render_view" (dict "page" $block "item" . "view" ($block.Params.design.view | default "compact") "index" $index) }}
|
||||
{{end}}
|
||||
|
||||
{{/* Archive link */}}
|
||||
{{ $show_archive_link := $st.Params.content.archive.enable | default (gt $count $items_count) }}
|
||||
{{ $show_archive_link := $block.Params.content.archive.enable | default (gt $count $items_count) }}
|
||||
{{ if $show_archive_link | and $archive_page }}
|
||||
|
||||
{{ $archive_link := "" }}
|
||||
{{ if $st.Params.content.archive.link }}
|
||||
{{ $archive_link = $st.Params.content.archive.link | relLangURL }}
|
||||
{{ if $block.Params.content.archive.link }}
|
||||
{{ $archive_link = $block.Params.content.archive.link | relLangURL }}
|
||||
{{ else }}
|
||||
{{ $archive_link = $archive_page.RelPermalink }}
|
||||
{{ end }}
|
||||
@@ -104,7 +108,7 @@
|
||||
{{ $i18n = "more_pages" }}
|
||||
{{ end }}
|
||||
|
||||
{{ $archive_text := $st.Params.content.archive.text | default (i18n $i18n) | default "See all" }}
|
||||
{{ $archive_text := $block.Params.content.archive.text | default (i18n $i18n) | default "See all" }}
|
||||
|
||||
<div class="see-all">
|
||||
<a href="{{ $archive_link }}">
|
||||
+21
-16
@@ -1,26 +1,31 @@
|
||||
{{ $ := .root }}
|
||||
{{ $st := .page }}
|
||||
{{ $autolink := default true $st.Params.content.autolink }}
|
||||
{{ $data := $st.Params.content }}
|
||||
{{/* Wowchemy Blocks: Contact */}}
|
||||
{{/* Documentation: https://wowchemy.com/blocks/ */}}
|
||||
{{/* License: https://github.com/wowchemy/wowchemy-hugo-themes/blob/main/LICENSE.md */}}
|
||||
|
||||
{{ $form_provider := lower $st.Params.content.form.provider | default "" }}
|
||||
{{ $form_provider_legacy := $st.Params.email_form | default 0 }}
|
||||
{{/* Initialise */}}
|
||||
{{ $page := .wcPage }}
|
||||
{{ $block := .wcBlock }}
|
||||
{{ $autolink := default true $block.Params.content.autolink }}
|
||||
{{ $data := $block.Params.content }}
|
||||
|
||||
{{ $form_provider := lower $block.Params.content.form.provider | default "" }}
|
||||
{{ $form_provider_legacy := $block.Params.email_form | default 0 }}
|
||||
|
||||
{{ $use_netlify_form := eq $form_provider "netlify" | or (eq $form_provider_legacy 1) }}
|
||||
{{ $use_formspree_form := eq $form_provider "formspree" | or (eq $form_provider_legacy 2) }}
|
||||
{{ $use_form := or $use_netlify_form $use_formspree_form }}
|
||||
|
||||
{{ $use_netlify_captcha := $st.Params.content.form.netlify.captcha | default true }}
|
||||
{{ $use_formspree_captcha := $st.Params.content.form.formspree.captcha | default false }}
|
||||
{{ $use_netlify_captcha := $block.Params.content.form.netlify.captcha | default true }}
|
||||
{{ $use_formspree_captcha := $block.Params.content.form.formspree.captcha | default false }}
|
||||
|
||||
{{ $columns := $st.Params.design.columns | default "2" }}
|
||||
{{ $columns := $block.Params.design.columns | default "2" }}
|
||||
|
||||
{{ if and $use_formspree_form $use_formspree_captcha }}
|
||||
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
|
||||
{{ end }}
|
||||
|
||||
<div class="col-12 {{if eq $columns "2"}}col-lg-8{{end}}">
|
||||
{{ with $st.Content }}{{ . }}{{ end }}
|
||||
{{ with $block.Content }}{{ . }}{{ end }}
|
||||
|
||||
{{ if $use_form }}
|
||||
|
||||
@@ -28,17 +33,17 @@
|
||||
{{ if $use_netlify_form }}
|
||||
{{ $post_action = "netlify" }}
|
||||
{{ else if $use_formspree_form }}
|
||||
{{ if not $st.Params.content.form.formspree.id }}
|
||||
{{ if not $block.Params.content.form.formspree.id }}
|
||||
{{ errorf "You have chosen to use Formspree as the provider for the contact form. Please set your Formspree Form ID in the Contact widget or disable the form.\nDocumentation: https://wowchemy.com/docs/widget/contact/" }}
|
||||
{{ end }}
|
||||
{{ if and $use_formspree_captcha (not $st.Params.content.form.formspree.captcha_key) }}
|
||||
{{ if and $use_formspree_captcha (not $block.Params.content.form.formspree.captcha_key) }}
|
||||
{{ errorf "You have chosen to use reCAPTCHA for Formspree. Please set your Formspree CAPTCHA KEY in the Contact widget or disable reCAPTCHA.\nDocumentation: https://help.formspree.io/hc/en-us/articles/360022811154" }}
|
||||
{{ end }}
|
||||
{{ $post_action = printf "action=\"https://formspree.io/f/%s\"" $st.Params.content.form.formspree.id }}
|
||||
{{ $post_action = printf "action=\"https://formspree.io/f/%s\"" $block.Params.content.form.formspree.id }}
|
||||
{{ end }}
|
||||
|
||||
<div class="mb-3">
|
||||
<form name="contact" method="POST" {{ $post_action | safeHTMLAttr }} {{ if $use_netlify_form }}netlify-honeypot="_gotcha"{{ end }} {{ if $use_netlify_captcha }}data-netlify-recaptcha="true"{{ end }} {{ with $st.Params.content.form.netlify.success_url }}action="{{ . | relLangURL }}"{{ end }}>
|
||||
<form name="contact" method="POST" {{ $post_action | safeHTMLAttr }} {{ if $use_netlify_form }}netlify-honeypot="_gotcha"{{ end }} {{ if $use_netlify_captcha }}data-netlify-recaptcha="true"{{ end }} {{ with $block.Params.content.form.netlify.success_url }}action="{{ . | relLangURL }}"{{ end }}>
|
||||
<div class="form-group form-inline">
|
||||
<label class="sr-only" for="inputName">{{ i18n "contact_name" }}</label>
|
||||
<input type="text" name="name" class="form-control w-100" id="inputName" placeholder="{{ i18n "contact_name" | default "Name" }}" required>
|
||||
@@ -51,7 +56,7 @@
|
||||
<label class="sr-only" for="inputMessage">{{ i18n "contact_message" }}</label>
|
||||
<textarea name="message" class="form-control" id="inputMessage" rows="5" placeholder="{{ i18n "contact_message" | default "Message" }}" required></textarea>
|
||||
</div>
|
||||
{{ if $st.Params.content.form.netlify.attachments }}
|
||||
{{ if $block.Params.content.form.netlify.attachments }}
|
||||
<div class="form-group form-inline">
|
||||
<label class="sr-only" for="fileUpload">{{ i18n "contact_attachment" }}</label>
|
||||
<input type="file" name="file" class="form-control w-100" id="fileUpload" placeholder="{{ i18n "contact_attachment" | default "Attach file" }}">
|
||||
@@ -63,7 +68,7 @@
|
||||
{{ if and $use_netlify_form $use_netlify_captcha }}
|
||||
<div class="form-group" data-netlify-recaptcha="true"></div>
|
||||
{{ else if and $use_formspree_form $use_formspree_captcha }}
|
||||
<div class="g-recaptcha" data-sitekey="{{ $st.Params.content.form.formspree.captcha_key }}"></div>
|
||||
<div class="g-recaptcha" data-sitekey="{{ $block.Params.content.form.formspree.captcha_key }}"></div>
|
||||
</br>
|
||||
{{ end }}
|
||||
<button type="submit" class="btn btn-primary px-3 py-2 w-100">{{ i18n "contact_send" | default "Send" }}</button>
|
||||
+14
-9
@@ -1,16 +1,21 @@
|
||||
{{ $ := .root }}
|
||||
{{ $page := .page }}
|
||||
{{ $columns := $page.Params.design.columns | default "2" }}
|
||||
{{/* Wowchemy Blocks: Experience */}}
|
||||
{{/* Documentation: https://wowchemy.com/blocks/ */}}
|
||||
{{/* License: https://github.com/wowchemy/wowchemy-hugo-themes/blob/main/LICENSE.md */}}
|
||||
|
||||
{{/* Initialise */}}
|
||||
{{ $page := .wcPage }}
|
||||
{{ $block := .wcBlock }}
|
||||
{{ $columns := $block.Params.design.columns | default "2" }}
|
||||
|
||||
<!-- Experience widget -->
|
||||
<div class="col-12 {{if eq $columns "2"}}col-lg-8{{end}}">
|
||||
{{ with $page.Content }}{{ . }}{{ end }}
|
||||
{{ with $block.Content }}{{ . }}{{ end }}
|
||||
|
||||
{{ if $page.Params.experience }}
|
||||
{{ $exp_len := len $page.Params.experience }}
|
||||
{{ if $block.Params.experience }}
|
||||
{{ $exp_len := len $block.Params.experience }}
|
||||
|
||||
{{/* Default to user's custom order (as requested in #1761) as Hugo doesn't support multiple sorts on params. */}}
|
||||
{{ range $idx, $key := $page.Params.experience }}
|
||||
{{ range $idx, $key := $block.Params.experience }}
|
||||
<div class="row experience">
|
||||
<!-- Timeline -->
|
||||
<div class="col-auto text-center flex-column d-none d-sm-flex">
|
||||
@@ -48,9 +53,9 @@
|
||||
{{- with .company_url}}<a href="{{.}}" target="_blank" rel="noopener">{{end}}{{.company | markdownify | emojify}}{{with .company_url}}</a>{{end -}}
|
||||
</div>
|
||||
<div class="text-muted exp-meta">
|
||||
{{ (time .date_start) | time.Format ($page.Params.date_format | default "January 2006") }} –
|
||||
{{ (time .date_start) | time.Format ($block.Params.date_format | default "January 2006") }} –
|
||||
{{ if .date_end}}
|
||||
{{ (time .date_end) | time.Format ($page.Params.date_format | default "January 2006") }}
|
||||
{{ (time .date_end) | time.Format ($block.Params.date_format | default "January 2006") }}
|
||||
{{else}}
|
||||
{{ i18n "present" | default "Present" }}
|
||||
{{end}}
|
||||
+11
-6
@@ -1,21 +1,26 @@
|
||||
{{ $ := .root }}
|
||||
{{ $page := .page }}
|
||||
{{/* Wowchemy Blocks: Features */}}
|
||||
{{/* Documentation: https://wowchemy.com/blocks/ */}}
|
||||
{{/* License: https://github.com/wowchemy/wowchemy-hugo-themes/blob/main/LICENSE.md */}}
|
||||
|
||||
{{/* Initialise */}}
|
||||
{{ $page := .wcPage }}
|
||||
{{ $block := .wcBlock }}
|
||||
|
||||
<div class="row featurette">
|
||||
{{ with $page.Title }}
|
||||
{{ with $block.Title }}
|
||||
<div class="col-md-12 section-heading">
|
||||
<h1>{{ . | markdownify | emojify }}</h1>
|
||||
{{ if $page.Params.subtitle }}<p>{{ $page.Params.subtitle | markdownify | emojify }}</p>{{ end }}
|
||||
{{ if $block.Params.subtitle }}<p>{{ $block.Params.subtitle | markdownify | emojify }}</p>{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ with $page.Content }}
|
||||
{{ with $block.Content }}
|
||||
<div class="col-md-12">
|
||||
{{ . }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ range $page.Params.feature }}
|
||||
{{ range $block.Params.feature }}
|
||||
{{ $pack := or .icon_pack "fas" }}
|
||||
{{ $pack_prefix := $pack }}
|
||||
{{ if in (slice "fab" "fas" "far" "fal") $pack }}
|
||||
+25
-20
@@ -1,28 +1,33 @@
|
||||
{{ $ := .root }}
|
||||
{{ $page := .page }}
|
||||
{{ $bg := $page.Params.design.background }}
|
||||
{{/* Wowchemy Blocks: Hero */}}
|
||||
{{/* Documentation: https://wowchemy.com/blocks/ */}}
|
||||
{{/* License: https://github.com/wowchemy/wowchemy-hugo-themes/blob/main/LICENSE.md */}}
|
||||
|
||||
{{ if $page.Params.hero_media }}
|
||||
{{/* Initialise */}}
|
||||
{{ $page := .wcPage }}
|
||||
{{ $block := .wcBlock }}
|
||||
{{ $bg := $block.Params.design.background }}
|
||||
|
||||
{{ if $block.Params.hero_media }}
|
||||
<div class="row">
|
||||
<div class="col-12 col-md-6 text-center text-md-left">
|
||||
{{ end }}
|
||||
|
||||
{{ with $page.Title }}
|
||||
{{ with $block.Title }}
|
||||
<h1 class="hero-title">{{ . | markdownify }}</h1>
|
||||
{{ end }}
|
||||
|
||||
{{ with $page.Content }}
|
||||
{{ with $block.Content }}
|
||||
<div class="hero-lead">{{ . }}</div>
|
||||
{{ end }}
|
||||
|
||||
{{/* Call-to-action link */}}
|
||||
{{ if $page.Params.cta.url }}
|
||||
{{ $pack := or $page.Params.cta.icon_pack "fas" }}
|
||||
{{ if $block.Params.cta.url }}
|
||||
{{ $pack := or $block.Params.cta.icon_pack "fas" }}
|
||||
{{ $pack_prefix := $pack }}
|
||||
{{ if in (slice "fab" "fas" "far" "fal") $pack }}
|
||||
{{ $pack_prefix = "fa" }}
|
||||
{{ end }}
|
||||
{{ $link := $page.Params.cta.url }}
|
||||
{{ $link := $block.Params.cta.url }}
|
||||
{{ $scheme := (urls.Parse $link).Scheme }}
|
||||
{{ $target := "" }}
|
||||
{{ if not $scheme }}
|
||||
@@ -31,11 +36,11 @@
|
||||
{{ $target = "target=\"_blank\" rel=\"noopener\"" }}
|
||||
{{ end }}
|
||||
<p class="cta-btns">
|
||||
<a href="{{ $link | safeURL }}" {{ $target | safeHTMLAttr }} class="btn {{if $bg.text_color_light}}btn-light{{else}}btn-primary{{end}} btn-lg mb-md-1">{{ if $page.Params.cta.icon }}<i class="{{ $pack }} {{ $pack_prefix }}-{{ $page.Params.cta.icon }} pr-1" aria-hidden="true"></i>{{end}}{{ $page.Params.cta.label | markdownify | emojify | safeHTML }}</a>
|
||||
<a href="{{ $link | safeURL }}" {{ $target | safeHTMLAttr }} class="btn {{if $bg.text_color_light}}btn-light{{else}}btn-primary{{end}} btn-lg mb-md-1">{{ if $block.Params.cta.icon }}<i class="{{ $pack }} {{ $pack_prefix }}-{{ $block.Params.cta.icon }} pr-1" aria-hidden="true"></i>{{end}}{{ $block.Params.cta.label | markdownify | emojify | safeHTML }}</a>
|
||||
|
||||
{{/* Alternative Call-to-action link */}}
|
||||
{{ if $page.Params.cta_alt.url }}
|
||||
{{ $link := $page.Params.cta_alt.url }}
|
||||
{{ if $block.Params.cta_alt.url }}
|
||||
{{ $link := $block.Params.cta_alt.url }}
|
||||
{{ $scheme := (urls.Parse $link).Scheme }}
|
||||
{{ $target := "" }}
|
||||
{{ if not $scheme }}
|
||||
@@ -43,31 +48,31 @@
|
||||
{{ else if in (slice "http" "https") $scheme }}
|
||||
{{ $target = "target=\"_blank\" rel=\"noopener\"" }}
|
||||
{{ end }}
|
||||
<a href="{{ $link | safeURL }}" {{ $target | safeHTMLAttr }} class="hero-cta-alt btn-lg pl-md-4">{{ $page.Params.cta_alt.label | markdownify | emojify | safeHTML }} <i class="fas fa-angle-right"></i></a>
|
||||
<a href="{{ $link | safeURL }}" {{ $target | safeHTMLAttr }} class="hero-cta-alt btn-lg pl-md-4">{{ $block.Params.cta_alt.label | markdownify | emojify | safeHTML }} <i class="fas fa-angle-right"></i></a>
|
||||
{{ end }}
|
||||
</p>
|
||||
{{ end }}
|
||||
|
||||
{{/* Call-to-action note */}}
|
||||
{{ with $page.Params.cta_note }}
|
||||
{{ with $block.Params.cta_note }}
|
||||
<p class="hero-note text-muted mb-3 mb-md-1">
|
||||
{{ .label | markdownify | emojify | safeHTML }}
|
||||
</p>
|
||||
{{ end }}
|
||||
|
||||
{{/* Hero image */}}
|
||||
{{ if $page.Params.hero_media }}
|
||||
{{ if $block.Params.hero_media }}
|
||||
</div>
|
||||
<div class="col-12 mx-auto col-md-6 {{if $page.Params.design.flip}}order-md-first{{end}} hero-media">
|
||||
{{- $image := ($page.Parent.Resources.ByType "image").GetMatch $page.Params.hero_media -}}
|
||||
<div class="col-12 mx-auto col-md-6 {{if $block.Params.design.flip}}order-md-first{{end}} hero-media">
|
||||
{{- $image := ($block.Parent.Resources.ByType "image").GetMatch $block.Params.hero_media -}}
|
||||
{{- if not $image -}}
|
||||
{{- $image = resources.Get (path.Join "media" $page.Params.hero_media) -}}
|
||||
{{- $image = resources.Get (path.Join "media" $block.Params.hero_media) -}}
|
||||
{{- end -}}
|
||||
{{ if $image }}
|
||||
{{ $isSVG := eq $image.MediaType.SubType "svg" }}
|
||||
{{ if $isSVG -}}
|
||||
|
||||
<img src="{{ $image.RelPermalink }}" alt="{{ $page.Title }}">
|
||||
<img src="{{ $image.RelPermalink }}" alt="{{ $block.Title }}">
|
||||
|
||||
{{- else }}
|
||||
|
||||
@@ -85,7 +90,7 @@
|
||||
{{ end }}
|
||||
{{ $img_src_set = delimit $img_src_set "," }}
|
||||
|
||||
<img src="{{ $legacy_img.RelPermalink }}" srcset="{{ $img_src_set }}" width="{{ $image.Width }}" height="{{ $image.Height }}" alt="{{ $page.Title }}">
|
||||
<img src="{{ $legacy_img.RelPermalink }}" srcset="{{ $img_src_set }}" width="{{ $image.Width }}" height="{{ $image.Height }}" alt="{{ $block.Title }}">
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</div>
|
||||
@@ -0,0 +1,18 @@
|
||||
{{/* Wowchemy Blocks: Markdown */}}
|
||||
{{/* Documentation: https://wowchemy.com/blocks/ */}}
|
||||
{{/* License: https://github.com/wowchemy/wowchemy-hugo-themes/blob/main/LICENSE.md */}}
|
||||
|
||||
{{/* Initialise */}}
|
||||
{{ $page := .wcPage }}
|
||||
{{ $block := .wcBlock }}
|
||||
{{ $columns := $block.Params.design.columns | default "2" }}
|
||||
|
||||
{{ if ne $columns "1" }}
|
||||
<div class="col-12 col-lg-8">
|
||||
{{ $block.Content }}
|
||||
</div>
|
||||
{{ else }}
|
||||
<div class="col-12">
|
||||
{{ $block.Content }}
|
||||
</div>
|
||||
{{ end }}
|
||||
+14
-12
@@ -1,31 +1,33 @@
|
||||
{{/* People Widget */}}
|
||||
{{/* Wowchemy Blocks: People */}}
|
||||
{{/* Documentation: https://wowchemy.com/blocks/ */}}
|
||||
{{/* License: https://github.com/wowchemy/wowchemy-hugo-themes/blob/main/LICENSE.md */}}
|
||||
|
||||
{{/* Initialise */}}
|
||||
{{ $ := .root }}
|
||||
{{ $page := .page }}
|
||||
{{ $show_social := $page.Params.design.show_social | default false }}
|
||||
{{ $show_interests := $page.Params.design.show_interests | default true }}
|
||||
{{ $show_organizations := $page.Params.design.show_organizations | default false }}
|
||||
{{ $show_role := $page.Params.design.show_role | default true }}
|
||||
{{ $page := .wcPage }}
|
||||
{{ $block := .wcBlock }}
|
||||
{{ $show_social := $block.Params.design.show_social | default false }}
|
||||
{{ $show_interests := $block.Params.design.show_interests | default true }}
|
||||
{{ $show_organizations := $block.Params.design.show_organizations | default false }}
|
||||
{{ $show_role := $block.Params.design.show_role | default true }}
|
||||
|
||||
<div class="row justify-content-center people-widget">
|
||||
{{ with $page.Title }}
|
||||
{{ with $block.Title }}
|
||||
<div class="col-md-12 section-heading">
|
||||
<h1>{{ . | markdownify | emojify }}</h1>
|
||||
{{ if $page.Params.subtitle }}<p>{{ $page.Params.subtitle | markdownify | emojify }}</p>{{ end }}
|
||||
{{ if $block.Params.subtitle }}<p>{{ $block.Params.subtitle | markdownify | emojify }}</p>{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ with $page.Content }}
|
||||
{{ with $block.Content }}
|
||||
<div class="col-md-12">
|
||||
{{ . }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ range $page.Params.content.user_groups }}
|
||||
{{ range $block.Params.content.user_groups }}
|
||||
{{ $query := where (where site.Pages "Section" "authors") ".Params.user_groups" "intersect" (slice .) }}
|
||||
|
||||
{{if $query | and (gt (len $page.Params.content.user_groups) 1) }}
|
||||
{{if $query | and (gt (len $block.Params.content.user_groups) 1) }}
|
||||
<div class="col-md-12">
|
||||
<h2 class="mb-4">{{ . | markdownify }}</h2>
|
||||
</div>
|
||||
+23
-21
@@ -1,24 +1,26 @@
|
||||
{{/* Portfolio Widget */}}
|
||||
{{/* Wowchemy Blocks: Portfolio */}}
|
||||
{{/* Documentation: https://wowchemy.com/blocks/ */}}
|
||||
{{/* License: https://github.com/wowchemy/wowchemy-hugo-themes/blob/main/LICENSE.md */}}
|
||||
|
||||
{{/* Initialise */}}
|
||||
{{ $ := .root }}
|
||||
{{ $st := .page }}
|
||||
{{ $columns := $st.Params.design.columns | default "2" }}
|
||||
{{ $view := $st.Params.design.view | default "masonry" }}
|
||||
{{ $page := .wcPage }}
|
||||
{{ $block := .wcBlock }}
|
||||
{{ $columns := $block.Params.design.columns | default "2" }}
|
||||
{{ $view := $block.Params.design.view | default "masonry" }}
|
||||
|
||||
{{/* Require Isotope */}}
|
||||
{{ $.Page.Store.Set "has_isotope" true }}
|
||||
{{ $page.Page.Store.Set "has_isotope" true }}
|
||||
|
||||
<div class="col-12 {{if eq $columns "2"}}col-lg-8{{end}}">
|
||||
|
||||
{{ with $st.Content }}{{ . }}{{ end }}
|
||||
{{ with $block.Content }}{{ . }}{{ end }}
|
||||
|
||||
{{ if $st.Params.content.filter_button }}
|
||||
{{ if $block.Params.content.filter_button }}
|
||||
|
||||
{{ $filter_default := default (int $st.Params.content.filter_default) 0 }}
|
||||
{{ $filter_default := default (int $block.Params.content.filter_default) 0 }}
|
||||
|
||||
{{/* Parse default filter tag from front matter in the form of either tag name or CSS class name. */}}
|
||||
{{ $default_filter_item := (index $st.Params.content.filter_button ($filter_default)) }}
|
||||
{{ $default_filter_item := (index $block.Params.content.filter_button ($filter_default)) }}
|
||||
{{ $default_data_filter := "" }}
|
||||
{{ with $default_filter_item.filter }}
|
||||
{{ $default_data_filter = . }}
|
||||
@@ -34,12 +36,12 @@
|
||||
<span class="d-none default-project-filter">{{ $default_data_filter }}</span>
|
||||
|
||||
{{/* Only show filter buttons if there are multiple filters. */}}
|
||||
{{ if gt (len $st.Params.content.filter_button) 1 }}
|
||||
{{ if gt (len $block.Params.content.filter_button) 1 }}
|
||||
<div class="project-toolbar">
|
||||
<div class="project-filters">
|
||||
<div class="btn-toolbar {{if eq $columns "1"}}d-flex justify-content-center{{end}}">
|
||||
<div class="btn-group flex-wrap">
|
||||
{{ range $idx, $item := $st.Params.content.filter_button }}
|
||||
{{ range $idx, $item := $block.Params.content.filter_button }}
|
||||
{{/* Parse filter tag from front matter in the form of either tag name or CSS class name. */}}
|
||||
{{ $data_filter := "" }}
|
||||
{{ with .filter }}
|
||||
@@ -60,32 +62,32 @@
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
<div class="{{ if or $st.Params.content.filter_button (in (slice "masonry" 3) $view) }}isotope projects-container{{end}} {{if in (slice "masonry" 3) $view}}js-layout-masonry{{else}}row js-layout-row{{end}} {{ if eq $view "showcase" }}project-showcase{{end}}">
|
||||
<div class="{{ if or $block.Params.content.filter_button (in (slice "masonry" 3) $view) }}isotope projects-container{{end}} {{if in (slice "masonry" 3) $view}}js-layout-masonry{{else}}row js-layout-row{{end}} {{ if eq $view "showcase" }}project-showcase{{end}}">
|
||||
|
||||
{{/* Query */}}
|
||||
{{ $query := site.Pages }}
|
||||
|
||||
{{/* Filters */}}
|
||||
{{ with $st.Params.content.page_type }}
|
||||
{{ with $block.Params.content.page_type }}
|
||||
{{/* Legacy filter, superseded by `filters.folders` */}}
|
||||
{{ $query = where $query "Type" . }}
|
||||
{{ end }}
|
||||
{{ with $st.Params.content.filters.folders }}
|
||||
{{ with $block.Params.content.filters.folders }}
|
||||
{{ $query = where $query "Section" "in" . }}
|
||||
{{ end }}
|
||||
{{ with $st.Params.content.filters.tags }}
|
||||
{{ with $block.Params.content.filters.tags }}
|
||||
{{ $query = where $query "Params.tags" "intersect" . }}
|
||||
{{ end }}
|
||||
{{ with $st.Params.content.filters.exclude_tags }}
|
||||
{{ with $block.Params.content.filters.exclude_tags }}
|
||||
{{ $query = $query | symdiff (where site.Pages "Params.tags" "intersect" .) }}
|
||||
{{ end }}
|
||||
{{ with ($st.Params.content.filters.kinds | default (slice "page")) }}
|
||||
{{ with ($block.Params.content.filters.kinds | default (slice "page")) }}
|
||||
{{ $query = where $query "Kind" "in" . }}
|
||||
{{ end }}
|
||||
|
||||
{{/* Sort */}}
|
||||
{{ $sort_by := $st.Params.content.sort_by | default "Date" }}
|
||||
{{ $sort_ascending := $st.Params.content.sort_ascending | default (eq $st.Params.content.order "asc") | default false }}
|
||||
{{ $sort_by := $block.Params.content.sort_by | default "Date" }}
|
||||
{{ $sort_ascending := $block.Params.content.sort_ascending | default (eq $block.Params.content.order "asc") | default false }}
|
||||
{{ $sort_order := cond $sort_ascending "asc" "desc" }}
|
||||
{{ $query = sort $query $sort_by $sort_order }}
|
||||
|
||||
@@ -96,7 +98,7 @@
|
||||
{{else}}
|
||||
<div class="col-12 isotope-item {{ $js_tag_classes | safeHTMLAttr }}">
|
||||
{{end}}
|
||||
{{ partial "functions/render_view" (dict "page" $st "item" . "view" $view "index" $index) }}
|
||||
{{ partial "functions/render_view" (dict "page" $block "item" . "view" $view "index" $index) }}
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
+12
-7
@@ -1,22 +1,27 @@
|
||||
{{ $ := .root }}
|
||||
{{ $page := .page }}
|
||||
{{ $hash_id := .hash_id }}
|
||||
{{/* Wowchemy Blocks: Slider */}}
|
||||
{{/* Documentation: https://wowchemy.com/blocks/ */}}
|
||||
{{/* License: https://github.com/wowchemy/wowchemy-hugo-themes/blob/main/LICENSE.md */}}
|
||||
|
||||
{{/* Initialise */}}
|
||||
{{ $page := .wcPage }}
|
||||
{{ $block := .wcBlock }}
|
||||
{{ $hash_id := .wcIdentifier }}
|
||||
|
||||
<!-- Indicators -->
|
||||
<ol class="carousel-indicators">
|
||||
{{ range $index, $item := $page.Params.content.slides }}
|
||||
{{ range $index, $item := $block.Params.content.slides }}
|
||||
<li data-target="#{{$hash_id}}" data-slide-to="{{$index}}" {{if eq $index 0}}class="active"{{end}}></li>
|
||||
{{ end }}
|
||||
</ol>
|
||||
|
||||
<!-- Carousel slides wrapper -->
|
||||
<div class="carousel-inner">
|
||||
{{ range $index, $item := $page.Params.content.slides }}
|
||||
{{ range $index, $item := $block.Params.content.slides }}
|
||||
|
||||
{{ $style_bg := "" }}
|
||||
{{ $style_filter := "" }}
|
||||
|
||||
{{with $page.Params.design.slide_height}}
|
||||
{{with $block.Params.design.slide_height}}
|
||||
{{ $style_bg = printf "%s height: %s;" $style_bg . }}
|
||||
{{end}}
|
||||
|
||||
@@ -36,7 +41,7 @@
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
<div class="carousel-item{{if eq $index 0}} active{{end}} {{with $page.Params.design.is_fullscreen}}fullscreen{{end}}" style="{{$style_bg | safeCSS}}">
|
||||
<div class="carousel-item{{if eq $index 0}} active{{end}} {{with $block.Params.design.is_fullscreen}}fullscreen{{end}}" style="{{$style_bg | safeCSS}}">
|
||||
<div class="position-absolute d-flex w-100 h-100 justify-content-center align-items-center" style="{{$style_filter | safeCSS}}">
|
||||
{{/* To prevent control overlap, margins are based on $carousel-control-* in bootstrap-variables.scss */}}
|
||||
<div class="wg-hero dark container" style="margin-left: 6rem; margin-right: 6rem; text-align: {{$item.align | default "left"}};">
|
||||
+13
-9
@@ -1,11 +1,15 @@
|
||||
{{/* Initialise */}}
|
||||
{{ $ := .root }}
|
||||
{{ $st := .page }}
|
||||
{{ $taxonomy := $st.Params.content.taxonomy | default "tags" }}
|
||||
{{ $fontSmall := $st.Params.design.font_size_min | default 0.8 }}
|
||||
{{ $fontBig := $st.Params.design.font_size_max | default 2.5 }}
|
||||
{{/* Wowchemy Blocks: Tag Cloud */}}
|
||||
{{/* Documentation: https://wowchemy.com/blocks/ */}}
|
||||
{{/* License: https://github.com/wowchemy/wowchemy-hugo-themes/blob/main/LICENSE.md */}}
|
||||
|
||||
{{ $items_count := $st.Params.content.count }}
|
||||
{{/* Initialise */}}
|
||||
{{ $page := .wcPage }}
|
||||
{{ $block := .wcBlock }}
|
||||
{{ $taxonomy := $block.Params.content.taxonomy | default "tags" }}
|
||||
{{ $fontSmall := $block.Params.design.font_size_min | default 0.8 }}
|
||||
{{ $fontBig := $block.Params.design.font_size_max | default 2.5 }}
|
||||
|
||||
{{ $items_count := $block.Params.content.count }}
|
||||
{{ if eq $items_count 0 }}
|
||||
{{ $items_count = 65535 }}
|
||||
{{ else }}
|
||||
@@ -16,10 +20,10 @@
|
||||
{{ $tags := first $items_count (index site.Taxonomies $taxonomy).ByCount }}
|
||||
{{ $count := len $tags }}
|
||||
|
||||
{{ $columns := $st.Params.design.columns | default "2" }}
|
||||
{{ $columns := $block.Params.design.columns | default "2" }}
|
||||
|
||||
<div class="col-12 {{if eq $columns "2"}}col-lg-8{{else}}text-center{{end}}">
|
||||
{{ with $st.Content }}{{ . }}{{ end }}
|
||||
{{ with $block.Content }}{{ . }}{{ end }}
|
||||
|
||||
{{ if ne $count 0 }}
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
{{/* Wowchemy Block Parser */}}
|
||||
{{/* Documentation: https://wowchemy.com/blocks/ */}}
|
||||
{{/* License: https://github.com/wowchemy/wowchemy-hugo-themes/blob/main/LICENSE.md */}}
|
||||
|
||||
{{ $page := .page }}
|
||||
{{ $block := .block }}
|
||||
|
||||
{{ $block_type := lower $block.Params.widget | default "markdown" }}
|
||||
{{ if eq $block_type "blank" }}{{ $block_type = "markdown" }}{{ end }}{{/* Support legacy Blank block */}}
|
||||
{{ if eq $block_type "featurette" }}{{ $block_type = "features" }}{{ end }}{{/* Support legacy Featurette block */}}
|
||||
{{ if eq $block_type "pages" }}{{ $block_type = "collection" }}{{ end }}{{/* Support legacy Pages block */}}
|
||||
{{ if eq $block_type "featured" }}{{ $block_type = "collection" }}{{ end }}{{/* Support legacy Featured block */}}
|
||||
{{ $widget_path := printf "blocks/%s.html" $block_type }}
|
||||
{{ if not (templates.Exists (printf "partials/%s" $widget_path)) }}
|
||||
{{ errorf "%s uses a `%s` block but the `%s` block was not found at `layouts/partials/%s`" $block.File.Path $block_type $block_type $widget_path }}
|
||||
{{ end }}
|
||||
|
||||
{{/* Workaround to make Hugo's .Page.Store.Set cascade up to the parent of headless pages */}}
|
||||
{{ if $block.Page.Store.Get "has_mermaid" }}
|
||||
{{ $page.Page.Store.Set "has_mermaid" true }}
|
||||
{{ end }}
|
||||
|
||||
{{/* Begin widget styling */}}
|
||||
{{ $bg := $block.Params.design.background }}
|
||||
{{ $style := "" }}
|
||||
{{ $style_bg := "" }}
|
||||
|
||||
{{ if $bg.color }}
|
||||
{{ $style_bg = printf "background-color: %s;" ($bg.color | default "transparent") }}
|
||||
{{ end }}
|
||||
|
||||
{{ if and $bg.gradient_start $bg.gradient_end }}
|
||||
{{ $angle := string $bg.gradient_angle | default "90" }}
|
||||
{{ $style_bg = printf "%sbackground-image: linear-gradient(%sdeg, %s, %s);" $style_bg $angle $bg.gradient_start $bg.gradient_end }}
|
||||
{{ end }}
|
||||
|
||||
{{ $bg_video := "" }}
|
||||
{{ if $bg.video.path }}
|
||||
{{ $bg_video = resources.Get (printf "media/%s" $bg.video.path) }}
|
||||
{{ end }}
|
||||
{{ $bg_video_class := "" }}
|
||||
{{ if $bg.video.flip }}
|
||||
{{ $bg_video_class = "flip" }}
|
||||
{{ end }}
|
||||
|
||||
{{ if $bg.image }}
|
||||
{{/* See Hugo note on linking assets in styles: https://github.com/gohugoio/hugoThemes#common-permalink-issues */}}
|
||||
{{ $bg_img := resources.Get (printf "media/%s" $bg.image) }}
|
||||
{{ if $bg_img }}
|
||||
{{/* Exception for SVG as Hugo doesn't yet support image processing on SVG. */}}
|
||||
{{ if ne $bg_img.MediaType.SubType "svg" }}
|
||||
{{ $bg_img = $bg_img.Fit "1920x1920 webp" }}
|
||||
{{ end }}
|
||||
{{ $style_bg = printf "%sbackground-image: url('%s');" $style_bg $bg_img.Permalink }}
|
||||
{{ else }}
|
||||
{{ errorf "Couldn't find `%s` in the `assets/media/` folder - please add it." $bg.image }}
|
||||
{{ end }}
|
||||
{{ with $bg.image_size }}
|
||||
{{/* Allow sizes: actual, cover, and contain. */}}
|
||||
{{ $style_bg = printf "%sbackground-size: %s;" $style_bg (replace . "actual" "auto") }}
|
||||
{{ end }}
|
||||
{{ with $bg.image_position }}
|
||||
{{/* Allow valid CSS positions including left, center, and right. */}}
|
||||
{{ $style_bg = printf "%sbackground-position: %s;" $style_bg . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ if $bg.image_darken }}
|
||||
{{ $style_bg = printf "%sfilter: brightness(%s);" $style_bg (string $bg.image_darken) }}
|
||||
{{ end }}
|
||||
|
||||
{{ with $block.Params.design.spacing.padding }}
|
||||
{{ $style_pad := printf "padding: %s;" (delimit . " ") }}
|
||||
{{ $style = print $style $style_pad }}
|
||||
{{ end }}
|
||||
|
||||
{{/* Support for clip path (design.clip_path) */}}
|
||||
{{ with $block.Params.design.clip_path }}
|
||||
{{ $style_clip_path := printf "clip-path: %s;" . }}
|
||||
{{ $style = print $style $style_clip_path }}
|
||||
{{ end }}
|
||||
|
||||
{{ with ($block.Params.design.css_style | default $block.Params.advanced.css_style) }}
|
||||
{{ $style = print $style . }}
|
||||
{{ end }}
|
||||
|
||||
{{/* Fix Hugo's ContentBaseName returning wrong file base name when page section is within a bundle. */}}
|
||||
{{ $hash_id := replace $block.File.ContentBaseName "index" (path.Base .File.Dir) }}
|
||||
|
||||
{{ $widget_args := dict "wcPage" $page "wcBlock" $block "wcIdentifier" $hash_id }}
|
||||
{{ $css_classes := $block.Params.design.css_class | default $block.Params.advanced.css_class | default "" }}
|
||||
{{ $extra_attributes := "" }}
|
||||
{{ $use_container := true }}
|
||||
|
||||
{{/* Special case: Slider widget. */}}
|
||||
{{ if in (slice "slider") $block_type }}
|
||||
{{ $css_classes = print $css_classes " carousel slide" }}
|
||||
{{ $extra_attributes = printf "data-ride=\"carousel\" data-interval=\"%s\"" (cond ($block.Params.design.loop | default true) (string $block.Params.design.interval | default "3000") "false") }}
|
||||
{{ $use_container = false }}
|
||||
{{ end }}
|
||||
|
||||
{{ $widget_class := printf "wg-%s" (replace (replace $block_type "." "-") "_" "-") }}
|
||||
|
||||
{{ $widget_config_file := printf "widgets/%s-config.html" $block_type }}
|
||||
{{ if templates.Exists $widget_config_file }}
|
||||
{{ $cfg := partial $widget_config_file $widget_args }}
|
||||
{{ $use_container = $cfg.use_container }}
|
||||
{{end}}
|
||||
|
||||
{{ $columns := $block.Params.design.columns | default "2" }}
|
||||
{{ $use_cols := in (slice "collection" "experience" "accomplishments" "contact" "markdown" "tag_cloud" "portfolio") $block_type }}
|
||||
|
||||
{{/* Dedicated child div for bg prevents parallax 100% height issue within new CSS grid page wrapper. */}}
|
||||
<section id="{{$hash_id}}" class="home-section {{$widget_class}} {{if $bg.text_color_light}}dark{{else if (eq $bg.text_color_light false)}}light{{end}} {{with $css_classes}}{{.}}{{end}}" {{with $style}}style="{{. | safeCSS}}"{{end}} {{print $extra_attributes | safeHTMLAttr}}>
|
||||
<div class="home-section-bg {{if $bg.image}} bg-image{{if ($bg.image_parallax | default true) }} parallax{{end}}{{end}}" {{with $style_bg}}style="{{. | safeCSS}}"{{end}}>
|
||||
{{with $bg_video}}<video class="bg-video {{$bg_video_class}}" playsinline="" preload="auto" loop="" muted autoplay="" tabindex="-1" width="100%" height="100%" src="{{.RelPermalink}}" style="width: 100%; height: 100%; object-fit: cover; object-position: center center; opacity: 1;"></video>{{end}}
|
||||
</div>
|
||||
{{if $use_container}}<div class="container">{{end}}
|
||||
|
||||
{{if $use_cols}}
|
||||
<div class="row {{if not $block.Title | or (eq $columns "1") }}justify-content-center{{end}}">
|
||||
{{ if $block.Title }}
|
||||
{{ if eq $columns "1" }}
|
||||
<div class="section-heading col-12 mb-3 text-center">
|
||||
{{ with $block.Title }}<h1 class="mb-0">{{ . | markdownify | emojify }}</h1>{{ end }}
|
||||
{{ with $block.Params.subtitle }}<p class="mt-1">{{ . | markdownify | emojify }}</p>{{ end }}
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="section-heading col-12 col-lg-4 mb-3 mb-lg-0 d-flex flex-column align-items-center align-items-lg-start">
|
||||
{{ with $block.Title }}<h1 class="mb-0">{{ . | markdownify | emojify }}</h1>{{ end }}
|
||||
{{ with $block.Params.subtitle }}<p class="mt-1">{{ . | markdownify | emojify }}</p>{{ end }}
|
||||
</div>
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
||||
{{ partial $widget_path $widget_args }}
|
||||
|
||||
{{if $use_cols}}
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
{{if $use_container}}</div>{{end}}
|
||||
</section>
|
||||
@@ -1,7 +1,8 @@
|
||||
{{/* Notify JS that this is a widget page */}}
|
||||
<!-- TODO: use data attribute on <body> instead if this is still required -->
|
||||
<span class="js-widget-page d-none"></span>
|
||||
|
||||
{{/* Get widget page */}}
|
||||
{{/* Load widget page */}}
|
||||
{{ $page := "" }}
|
||||
{{ $headless_bundle := "" }}
|
||||
{{ if .IsHome }}
|
||||
@@ -25,144 +26,7 @@
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{/* Load page sections */}}
|
||||
{{ $has_mermaid := false }}
|
||||
{{ range $index, $st := where ( $headless_bundle.Resources.ByType "page" ) ".Params.active" "!=" false }}
|
||||
{{ if .Page.Store.Get "has_mermaid" }}
|
||||
{{ $has_mermaid = true }}
|
||||
{{ end }}
|
||||
|
||||
{{/* Begin widget styling */}}
|
||||
{{ $bg := $st.Params.design.background }}
|
||||
{{ $style := "" }}
|
||||
{{ $style_bg := "" }}
|
||||
|
||||
{{ if $bg.color }}
|
||||
{{ $style_bg = printf "background-color: %s;" ($bg.color | default "transparent") }}
|
||||
{{ end }}
|
||||
|
||||
{{ if and $bg.gradient_start $bg.gradient_end }}
|
||||
{{ $angle := string $bg.gradient_angle | default "90" }}
|
||||
{{ $style_bg = printf "%sbackground-image: linear-gradient(%sdeg, %s, %s);" $style_bg $angle $bg.gradient_start $bg.gradient_end }}
|
||||
{{ end }}
|
||||
|
||||
{{ $bg_video := "" }}
|
||||
{{ if $bg.video.path }}
|
||||
{{ $bg_video = resources.Get (printf "media/%s" $bg.video.path) }}
|
||||
{{ end }}
|
||||
{{ $bg_video_class := "" }}
|
||||
{{ if $bg.video.flip }}
|
||||
{{ $bg_video_class = "flip" }}
|
||||
{{ end }}
|
||||
|
||||
{{ if $bg.image }}
|
||||
{{/* See Hugo note on linking assets in styles: https://github.com/gohugoio/hugoThemes#common-permalink-issues */}}
|
||||
{{ $bg_img := resources.Get (printf "media/%s" $bg.image) }}
|
||||
{{ if $bg_img }}
|
||||
{{/* Exception for SVG as Hugo doesn't yet support image processing on SVG. */}}
|
||||
{{ if ne $bg_img.MediaType.SubType "svg" }}
|
||||
{{ $bg_img = $bg_img.Fit "1920x1920 webp" }}
|
||||
{{ end }}
|
||||
{{ $style_bg = printf "%sbackground-image: url('%s');" $style_bg $bg_img.Permalink }}
|
||||
{{ else }}
|
||||
{{ errorf "Couldn't find `%s` in the `assets/media/` folder - please add it." $bg.image }}
|
||||
{{ end }}
|
||||
{{ with $bg.image_size }}
|
||||
{{/* Allow sizes: actual, cover, and contain. */}}
|
||||
{{ $style_bg = printf "%sbackground-size: %s;" $style_bg (replace . "actual" "auto") }}
|
||||
{{ end }}
|
||||
{{ with $bg.image_position }}
|
||||
{{/* Allow valid CSS positions including left, center, and right. */}}
|
||||
{{ $style_bg = printf "%sbackground-position: %s;" $style_bg . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ if $bg.image_darken }}
|
||||
{{ $style_bg = printf "%sfilter: brightness(%s);" $style_bg (string $bg.image_darken) }}
|
||||
{{ end }}
|
||||
|
||||
{{ with $st.Params.design.spacing.padding }}
|
||||
{{ $style_pad := printf "padding: %s;" (delimit . " ") }}
|
||||
{{ $style = print $style $style_pad }}
|
||||
{{ end }}
|
||||
|
||||
{{/* Support for clip path (design.clip_path) */}}
|
||||
{{ with $st.Params.design.clip_path }}
|
||||
{{ $style_clip_path := printf "clip-path: %s;" . }}
|
||||
{{ $style = print $style $style_clip_path }}
|
||||
{{ end }}
|
||||
|
||||
{{ with ($st.Params.design.css_style | default $st.Params.advanced.css_style) }}
|
||||
{{ $style = print $style . }}
|
||||
{{ end }}
|
||||
|
||||
{{/* Fix Hugo's ContentBaseName returning wrong file base name when page section is within a bundle. */}}
|
||||
{{ $hash_id := replace $st.File.ContentBaseName "index" (path.Base .File.Dir) }}
|
||||
|
||||
{{ $widget := or $st.Params.widget "blank" }}
|
||||
{{ if eq $widget "custom" }}{{ $widget = "blank" }}{{ end }}{{/* Support legacy Custom widget */}}
|
||||
{{ if eq $widget "projects" }}{{ $widget = "portfolio" }}{{ end }}{{/* Support legacy Projects widget */}}
|
||||
|
||||
{{ $widget_path := printf "widgets/%s.html" $widget }}
|
||||
{{ $widget_args := dict "root" $ "page" $st "hash_id" $hash_id }}
|
||||
{{ $css_classes := $st.Params.design.css_class | default $st.Params.advanced.css_class | default "" }}
|
||||
{{ $extra_attributes := "" }}
|
||||
{{ $use_container := true }}
|
||||
|
||||
{{/* Special case: Slider widget. */}}
|
||||
{{ if in (slice "slider") $widget }}
|
||||
{{ $css_classes = print $css_classes " carousel slide" }}
|
||||
{{ $extra_attributes = printf "data-ride=\"carousel\" data-interval=\"%s\"" (cond ($st.Params.design.loop | default true) (string $st.Params.design.interval | default "3000") "false") }}
|
||||
{{ $use_container = false }}
|
||||
{{ end }}
|
||||
|
||||
{{ $widget_class := printf "wg-%s" (replace (replace $widget "." "-") "_" "-") }}
|
||||
|
||||
{{ $widget_config_file := printf "widgets/%s-config.html" $widget }}
|
||||
{{ if templates.Exists $widget_config_file }}
|
||||
{{ $cfg := partial $widget_config_file $widget_args }}
|
||||
{{ $use_container = $cfg.use_container }}
|
||||
{{end}}
|
||||
|
||||
{{ $columns := $st.Params.design.columns | default "2" }}
|
||||
{{ $use_cols := in (slice "pages" "featured" "experience" "accomplishments" "contact" "blank" "tag_cloud" "portfolio") $widget }}
|
||||
|
||||
{{/* Dedicated child div for bg prevents parallax 100% height issue within new CSS grid page wrapper. */}}
|
||||
<section id="{{$hash_id}}" class="home-section {{$widget_class}} {{if $bg.text_color_light}}dark{{else if (eq $bg.text_color_light false)}}light{{end}} {{with $css_classes}}{{.}}{{end}}" {{with $style}}style="{{. | safeCSS}}"{{end}} {{print $extra_attributes | safeHTMLAttr}}>
|
||||
<div class="home-section-bg {{if $bg.image}} bg-image{{if ($bg.image_parallax | default true) }} parallax{{end}}{{end}}" {{with $style_bg}}style="{{. | safeCSS}}"{{end}}>
|
||||
{{with $bg_video}}<video class="bg-video {{$bg_video_class}}" playsinline="" preload="auto" loop="" muted autoplay="" tabindex="-1" width="100%" height="100%" src="{{.RelPermalink}}" style="width: 100%; height: 100%; object-fit: cover; object-position: center center; opacity: 1;"></video>{{end}}
|
||||
</div>
|
||||
{{if $use_container}}<div class="container">{{end}}
|
||||
|
||||
{{if $use_cols}}
|
||||
<div class="row {{if not $st.Title | or (eq $columns "1") }}justify-content-center{{end}}">
|
||||
{{ if $st.Title }}
|
||||
{{ if eq $columns "1" }}
|
||||
<div class="section-heading col-12 mb-3 text-center">
|
||||
{{ with $st.Title }}<h1 class="mb-0">{{ . | markdownify | emojify }}</h1>{{ end }}
|
||||
{{ with $st.Params.subtitle }}<p class="mt-1">{{ . | markdownify | emojify }}</p>{{ end }}
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="section-heading col-12 col-lg-4 mb-3 mb-lg-0 d-flex flex-column align-items-center align-items-lg-start">
|
||||
{{ with $st.Title }}<h1 class="mb-0">{{ . | markdownify | emojify }}</h1>{{ end }}
|
||||
{{ with $st.Params.subtitle }}<p class="mt-1">{{ . | markdownify | emojify }}</p>{{ end }}
|
||||
</div>
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
||||
{{ partial $widget_path $widget_args }}
|
||||
|
||||
{{if $use_cols}}
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
{{if $use_container}}</div>{{end}}
|
||||
</section>
|
||||
{{/* Load Wowchemy blocks */}}
|
||||
{{ range $index, $block := where ( $headless_bundle.Resources.ByType "page" ) ".Params.active" "!=" false }}
|
||||
{{ partial "functions/parse_block" (dict "page" $ "block" $block) }}
|
||||
{{ end }}
|
||||
|
||||
{{/* Workaround to make Hugo's .Page.Store.Set cascade up to the parent of headless pages */}}
|
||||
{{ if $has_mermaid }}
|
||||
{{ .Page.Store.Set "has_mermaid" true }}
|
||||
{{ end }}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
{{ $st := .page }}
|
||||
{{ $columns := $st.Params.design.columns | default "2" }}
|
||||
|
||||
{{ if ne $columns "1" }}
|
||||
<div class="col-12 col-lg-8">
|
||||
{{ $st.Content }}
|
||||
</div>
|
||||
{{ else }}
|
||||
<div class="col-12">
|
||||
{{ $st.Content }}
|
||||
</div>
|
||||
{{ end }}
|
||||
@@ -1,84 +0,0 @@
|
||||
{{/* Featured Content Widget */}}
|
||||
|
||||
{{/* Initialise */}}
|
||||
{{ $ := .root }}
|
||||
{{ $st := .page }}
|
||||
{{ $items_type := $st.Params.content.page_type | default "post" }}
|
||||
{{ $items_count := $st.Params.content.count | default 65535 }}
|
||||
{{ $items_sort := $st.Params.content.order| default "desc" }}
|
||||
|
||||
{{/* Query */}}
|
||||
{{ $query := where (where site.RegularPages "Type" $items_type) "Params.featured" true }}
|
||||
{{ $archive_page := site.GetPage "Section" $items_type }}
|
||||
|
||||
{{/* Filters */}}
|
||||
{{ if $st.Params.content.filters.tag }}
|
||||
{{ $archive_page := site.GetPage (printf "tags/%s" (urlize $st.Params.content.filters.tag)) }}
|
||||
{{ $query = $query | intersect $archive_page.Pages }}
|
||||
{{ end }}
|
||||
{{ if $st.Params.content.filters.category }}
|
||||
{{ $archive_page := site.GetPage (printf "categories/%s" (urlize $st.Params.content.filters.category)) }}
|
||||
{{ $query = $query | intersect $archive_page.Pages }}
|
||||
{{ end }}
|
||||
{{ if $st.Params.content.filters.publication_type }}
|
||||
{{ $archive_page := site.GetPage (printf "publication_types/%s" $st.Params.content.filters.publication_type) }}
|
||||
{{ $query = $query | intersect $archive_page.Pages }}
|
||||
{{ end }}
|
||||
{{ if $st.Params.content.filters.author }}
|
||||
{{ $archive_page = site.GetPage (printf "authors/%s" (urlize $st.Params.content.filters.author)) }}
|
||||
{{ $query = $query | intersect $archive_page.Pages }}
|
||||
{{ end }}
|
||||
|
||||
{{ $count := len $query }}
|
||||
|
||||
{{/* Sort */}}
|
||||
{{ $sort_by := "Date" }}
|
||||
{{ $query = sort $query $sort_by $items_sort }}
|
||||
|
||||
{{/* Limit */}}
|
||||
{{ $query = first $items_count $query }}
|
||||
|
||||
{{/* Localisation */}}
|
||||
{{ $i18n := "" }}
|
||||
{{ if eq $items_type "post" }}
|
||||
{{ $i18n = "more_posts" }}
|
||||
{{ else if eq $items_type "event" }}
|
||||
{{ $i18n = "more_talks" }}
|
||||
{{ else if eq $items_type "publication" }}
|
||||
{{ $i18n = "more_publications" }}
|
||||
{{ else }}
|
||||
{{ $i18n = "more_pages" }}
|
||||
{{ end }}
|
||||
|
||||
{{ $columns := $st.Params.design.columns | default "2" }}
|
||||
|
||||
<div class="col-12 {{if eq $columns "2"}}col-lg-8{{end}}">
|
||||
|
||||
{{ with $st.Content }}{{ . }}{{ end }}
|
||||
|
||||
{{ range $index, $post := $query }}
|
||||
{{ partial "functions/render_view" (dict "page" $st "item" . "view" ($st.Params.design.view | default "compact") "index" $index) }}
|
||||
{{end}}
|
||||
|
||||
{{/* Archive link */}}
|
||||
{{ $show_archive_link := $st.Params.content.archive.enable | default (gt $count $items_count) }}
|
||||
{{ if $show_archive_link }}
|
||||
|
||||
{{ $archive_link := "" }}
|
||||
{{ if $st.Params.content.archive.link }}
|
||||
{{ $archive_link = $st.Params.content.archive.link | relLangURL }}
|
||||
{{ else }}
|
||||
{{ $archive_link = $archive_page.RelPermalink }}
|
||||
{{ end }}
|
||||
|
||||
{{ $archive_text := $st.Params.content.archive.text | default (i18n $i18n) | default "See all" }}
|
||||
|
||||
<div class="see-all">
|
||||
<a href="{{ $archive_link }}">
|
||||
{{ $archive_text | emojify }}
|
||||
<i class="fas fa-angle-right"></i>
|
||||
</a>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
</div>
|
||||
Reference in new issue
Block a user