| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 | {{/* Notify JS that this is a widget page */}}<span class="js-widget-page d-none"></span>{{/* Get widget page */}}{{ $page := "" }}{{ $headless_bundle := "" }}{{ if .IsHome }}  {{ $page = "/home/index.md" }}  {{ $headless_bundle = site.GetPage $page }}  {{/* Check homepage exists */}}  {{ if not $headless_bundle }}    {{ warnf "Hugo cannot find a Widget Page at %s!" $page }}    {{ warnf "If the page exists, Hugo Server may need restarting due to file changes." }}    {{ warnf "Add the `/home/index.md` homepage file to each language's content folder. For example, your site should have a `content/home/` folder containing `index.md` and your homepage sections, or for multi-language sites, `content/en/home/` and `content/zh/home/` etc. Refer to the 'Build Your Homepage' and 'Language' documentation at https://wowchemy.com/docs/ and the example homepage at https://github.com/wowchemy/starter-academic/tree/master/exampleSite/content/home/index.md ." }}  {{ end }}{{ else }}  {{ $page = .File.Path }}  {{ $headless_bundle = site.GetPage $page }}  {{/* Check widget page exists. */}}  {{ if not $headless_bundle }}    {{ warnf "Hugo cannot find a Widget Page at %s!" $page }}    {{ warnf "If the page exists, Hugo Server may need restarting due to file changes." }}    {{ warnf "View the Widget Page documentation at https://wowchemy.com/docs/managing-content/#create-a-widget-page ." }}    {{ warnf "If the Hugo version is between 0.65 and 0.68, it may be a confirmed Hugo bug that is expected to be fixed in Hugo v0.69: https://github.com/wowchemy/wowchemy-hugo-themes/issues/1595#issuecomment-605514973 ." }}  {{ end }}{{ end }}{{/* Load page sections */}}{{ range $index, $st := where ( $headless_bundle.Resources.ByType "page" ) ".Params.active" "!=" false }}  {{/* 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 }}      {{ $bg_img = $bg_img.Fit "1920x1920 webp" }}      {{ $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 (path.Split .Path).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\"" (string $st.Params.interval | default "5000") }}    {{ $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>{{ end }}
 |