portfolio.html 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. {{/* Portfolio Widget */}}
  2. {{/* Initialise */}}
  3. {{ $ := .root }}
  4. {{ $st := .page }}
  5. {{ $items_type := $st.Params.content.page_type | default "project" }}
  6. {{ $columns := $st.Params.design.columns | default "2" }}
  7. {{ if ne $columns "1" }}
  8. {{/* Standard dual-column layout. */}}
  9. <div class="row">
  10. <div class="col-12 col-lg-4 section-heading">
  11. {{ with $st.Title }}<h1>{{ . | markdownify | emojify }}</h1>{{ end }}
  12. {{ with $st.Params.subtitle }}<p>{{ . | markdownify | emojify }}</p>{{ end }}
  13. </div>
  14. <div class="col-12 col-lg-8">
  15. {{ else }}
  16. {{/* Single column layout. */}}
  17. <div class="margin-auto">
  18. <div class="center-text">
  19. {{ with $st.Title }}<h1 class="mt-0">{{ . | markdownify | emojify }}</h1>{{ end }}
  20. {{ with $st.Params.subtitle }}<p>{{ . | markdownify | emojify }}</p>{{ end }}
  21. </div>
  22. <div>
  23. {{ end }}
  24. {{ with $st.Content }}{{ . }}{{ end }}
  25. {{ if $st.Params.content.filter_button }}
  26. {{ $filter_default := default (int $st.Params.content.filter_default) 0 }}
  27. {{/* Parse default filter tag from front matter in the form of either tag name or CSS class name. */}}
  28. {{ $default_filter_tag_raw := (index $st.Params.content.filter_button ($filter_default)).tag }}
  29. {{ $default_filter_tag := printf ".js-id-%s" (replace $default_filter_tag_raw " " "-") }}
  30. {{ if or (eq (substr $default_filter_tag_raw 0 1) "*") (eq (substr $default_filter_tag_raw 0 1) ".") }}
  31. {{ $default_filter_tag = $default_filter_tag_raw }}
  32. {{ end }}
  33. <span class="d-none default-project-filter">{{ $default_filter_tag }}</span>
  34. {{/* Only show filter buttons if there are multiple filters. */}}
  35. {{ if gt (len $st.Params.content.filter_button) 1 }}
  36. <div class="project-toolbar">
  37. <div class="project-filters">
  38. <div class="btn-toolbar">
  39. <div class="btn-group flex-wrap">
  40. {{ range $idx, $item := $st.Params.content.filter_button }}
  41. {{/* Parse filter tag from front matter in the form of either tag name or CSS class name. */}}
  42. {{ $data_filter := printf ".js-id-%s" (replace .tag " " "-") }}
  43. {{ if or (eq (substr .tag 0 1) "*") (eq (substr .tag 0 1) ".") }}
  44. {{ $data_filter = .tag }}
  45. {{ end }}
  46. <a href="#" data-filter="{{ $data_filter | safeHTMLAttr }}" class="btn btn-primary btn-lg{{ if eq $idx $filter_default }} active{{ end }}">{{ .name }}</a>
  47. {{ end }}
  48. </div>
  49. </div>
  50. </div>
  51. </div>
  52. {{ end }}
  53. {{ end }}
  54. <div class="{{ if or $st.Params.content.filter_button (eq $st.Params.design.view 3) }}isotope projects-container{{end}} {{if eq $st.Params.design.view 3}}js-layout-masonry{{else}}row js-layout-row{{end}} {{ if eq $st.Params.design.view 5 }}project-showcase mt-5{{end}}">
  55. {{ range $idx, $item := where site.RegularPages "Type" $items_type }}
  56. {{ $link := $item.RelPermalink }}
  57. {{ $target := "" }}
  58. {{ if $item.Params.external_link }}
  59. {{ $link = $item.Params.external_link }}
  60. {{ $target = "target=\"_blank\" rel=\"noopener\"" }}
  61. {{ end }}
  62. {{ if eq $st.Params.design.view 1 }}
  63. {{ partial "portfolio_li_list" (dict "item" $item) }}
  64. {{ else if eq $st.Params.design.view 2 }}
  65. {{ partial "portfolio_li_compact" (dict "item" $item) }}
  66. {{ else if eq $st.Params.design.view 3 }}
  67. {{ partial "portfolio_li_card" (dict "widget" $st "index" $idx "item" $item "link" $link "target" $target) }}
  68. {{ else }}
  69. {{ partial "portfolio_li_showcase" (dict "widget" $st "index" $idx "item" $item "link" $link "target" $target) }}
  70. {{ end }}
  71. {{ end }}
  72. </div>
  73. </div>
  74. </div>