widget_page.html 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. {{ partial "header.html" . }}
  2. {{ partial "navbar.html" . }}
  3. <!-- Flag for jQuery -->
  4. <span id="homepage" class="d-none"></span>
  5. {{ $section := "" }}
  6. {{ if .IsHome }}
  7. {{ $section = "home" }}
  8. {{ else }}
  9. {{ $section = .Section }}
  10. {{ end }}
  11. <!-- Widgets -->
  12. {{ range $index, $st := where (where .Data.Pages "Section" $section) ".Params.active" "!=" false }}
  13. {{/* Begin widget styling */}}
  14. {{ $bg := $st.Params.design.background }}
  15. {{ $style := "" }}
  16. {{ if $bg.color }}
  17. {{ $style = printf "background-color: %s;" ($bg.color | default "transparent") }}
  18. {{ end }}
  19. {{ if and $bg.gradient_start $bg.gradient_end }}
  20. {{ $style = printf "%sbackground-image: linear-gradient(%s, %s);" $style $bg.gradient_start $bg.gradient_end }}
  21. {{ end }}
  22. {{ if $bg.image }}
  23. {{ $darken := "" }}
  24. {{ if $bg.image_darken }}
  25. {{ $darken = printf "linear-gradient(rgba(0, 0, 0, %s), rgba(0, 0, 0, %s))," (string $bg.image_darken) (string $bg.image_darken) }}
  26. {{ end }}
  27. {{/* See Hugo note on linking assets in styles: https://github.com/gohugoio/hugoThemes#common-permalink-issues */}}
  28. {{ $style = printf "%sbackground-image: %s url('%s');" $style $darken (printf "img/%s" $bg.image | absURL) }}
  29. {{ end }}
  30. {{ with $st.Params.advanced.css_style }}
  31. {{ $style = print $style . }}
  32. {{ end }}
  33. {{ $params := dict "root" $ "page" $st }}
  34. {{ $widget := or $st.Params.widget "blank" }}
  35. {{ if eq $widget "custom" }}{{ $widget = "blank" }}{{ end }}{{/* Support legacy Custom widget */}}
  36. {{ if eq $widget "projects" }}{{ $widget = "portfolio" }}{{ end }}{{/* Support legacy Projects widget */}}
  37. {{ $widget_path := printf "widgets/%s.html" $widget }}
  38. {{ if in (slice "slider") $widget }}
  39. {{ partial $widget_path $params }}
  40. {{ else }}
  41. <section id="{{ $st.File.TranslationBaseName }}" class="home-section {{ printf "wg-%s" (replace $widget "_" "-") }} {{if $bg.text_color_light}}dark{{end}} {{if $bg.image}}parallax{{end}} {{ with $st.Params.advanced.css_class }}{{ . }}{{ end }}" {{with $style}}style="{{. | safeCSS}}"{{end}}>
  42. <div class="container">
  43. {{ partial $widget_path $params }}
  44. </div>
  45. </section>
  46. {{ end }}
  47. {{ end }}
  48. <!-- Page Footer -->
  49. {{ partial "footer_container.html" . }}
  50. {{ partial "footer.html" . }}