{{/* Notify JS that this is a widget page */}} {{/* 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\"" (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. */}}
{{with $bg_video}}{{end}}
{{if $use_container}}
{{end}} {{if $use_cols}}
{{ if $st.Title }} {{ if eq $columns "1" }}
{{ with $st.Title }}

{{ . | markdownify | emojify }}

{{ end }} {{ with $st.Params.subtitle }}

{{ . | markdownify | emojify }}

{{ end }}
{{else}}
{{ with $st.Title }}

{{ . | markdownify | emojify }}

{{ end }} {{ with $st.Params.subtitle }}

{{ . | markdownify | emojify }}

{{ end }}
{{end}} {{end}} {{end}} {{ partial $widget_path $widget_args }} {{if $use_cols}}
{{end}} {{if $use_container}}
{{end}}
{{ end }}