diff --git a/exampleSite/content/home/projects.md b/exampleSite/content/home/projects.md index 8378d229..09e5be2b 100644 --- a/exampleSite/content/home/projects.md +++ b/exampleSite/content/home/projects.md @@ -39,6 +39,7 @@ subtitle = "" # Toggle between the various page layout types. # 1 = List + # 2 = Compact # 3 = Card # 5 = Showcase view = 3 diff --git a/layouts/partials/li_compact.html b/layouts/partials/li_compact.html index 1e8b72c2..e3adc23c 100644 --- a/layouts/partials/li_compact.html +++ b/layouts/partials/li_compact.html @@ -3,6 +3,12 @@ {{ $microdata_type := "CreativeWork" }} {{ $show_authors_only := false }}{{/* Show authors only or full metadata? */}} {{ $show_buttons := false }} +{{ $link := $item.RelPermalink }} +{{ $target := "" }} +{{ if $item.Params.external_link }} + {{ $link = $item.Params.external_link }} + {{ $target = "target=\"_blank\" rel=\"noopener\"" }} +{{ end }} {{/* Dynamic view adjusts to content type. */}} {{ if eq $item.Type "post" }} @@ -15,6 +21,10 @@ {{ $microdata_type = "ScholarlyArticle" }} {{ $show_authors_only = true }} {{ $show_buttons = true }} +{{ else if eq $item.Type "project" }} + {{ $microdata_type = "CreativeWork" }} + {{ $show_authors_only = true }} + {{ $show_buttons = true }} {{ end }} {{/* Get summary. */}} @@ -31,7 +41,7 @@

- +

{{ with $summary }} @@ -74,7 +84,7 @@ {{ $resource := ($item.Resources.ByType "image").GetMatch "*featured*" }} {{ with $resource }} {{ $image := .Resize "150x" }} - + {{end}} diff --git a/layouts/partials/li_list.html b/layouts/partials/li_list.html index 05ce93f0..436c5513 100644 --- a/layouts/partials/li_list.html +++ b/layouts/partials/li_list.html @@ -1,9 +1,16 @@ {{ $item := . }} {{ $microdata_type := "CreativeWork" }} +{{ $icon_pack := "far" }} {{ $icon := "fa-file-alt" }} {{ $show_authors := false }} {{ $show_buttons := false }} +{{ $link := $item.RelPermalink }} +{{ $target := "" }} +{{ if $item.Params.external_link }} + {{ $link = $item.Params.external_link }} + {{ $target = "target=\"_blank\" rel=\"noopener\"" }} +{{ end }} {{/* Dynamic view adjusts to content type. */}} {{ if eq $item.Type "post" }} @@ -16,11 +23,17 @@ {{ $microdata_type = "ScholarlyArticle" }} {{ $show_authors = true }} {{ $show_buttons = true }} +{{ else if eq $item.Type "project" }} + {{ $microdata_type = "CreativeWork" }} + {{ $icon_pack = "fas" }} + {{ $icon = "fa-project-diagram" }} + {{ $show_authors = true }} + {{ $show_buttons = true }} {{ end }}
- - + + {{ if eq $item.Type "talk" }} diff --git a/layouts/partials/portfolio_li_compact.html b/layouts/partials/portfolio_li_compact.html new file mode 100644 index 00000000..336a38d9 --- /dev/null +++ b/layouts/partials/portfolio_li_compact.html @@ -0,0 +1,6 @@ +{{ $item := .item }} +{{ $js_tag_classes := delimit (apply (apply $item.Params.tags "replace" "." " " "-") "printf" "js-id-%s" ".") " " }} + +
+ {{ partial "li_compact" $item }} +
diff --git a/layouts/partials/portfolio_li_list.html b/layouts/partials/portfolio_li_list.html new file mode 100644 index 00000000..6671d24c --- /dev/null +++ b/layouts/partials/portfolio_li_list.html @@ -0,0 +1,6 @@ +{{ $item := .item }} +{{ $js_tag_classes := delimit (apply (apply $item.Params.tags "replace" "." " " "-") "printf" "js-id-%s" ".") " " }} + +
+ {{ partial "li_list" $item }} +
diff --git a/layouts/partials/project_li_showcase.html b/layouts/partials/portfolio_li_showcase.html similarity index 81% rename from layouts/partials/project_li_showcase.html rename to layouts/partials/portfolio_li_showcase.html index 0e884959..be772e33 100644 --- a/layouts/partials/project_li_showcase.html +++ b/layouts/partials/portfolio_li_showcase.html @@ -11,6 +11,18 @@ {{ $link := .link }} {{ $target := .target }} +{{/* Get summary. */}} +{{ $summary := "" }} +{{ if $item.Params.summary }} + {{ $summary = $item.Params.summary | markdownify | emojify }} +{{ else if .Params.abstract }} + {{ $summary = .Params.abstract | markdownify | emojify }} +{{ else if $item.Truncated }} + {{ $summary = $item.Summary }} +{{ else }} + {{ $summary = $item.Content }} +{{ end }} + {{ $order := "" }} {{ if and ($widget.Params.design.flip_alt_rows | default true) (not (modBool .index 2)) }} {{ $order = "order-md-2" }} @@ -27,15 +39,9 @@ {{- if $do_link}}{{end -}} - {{ $summary := "" }} - {{ if $item.Params.summary }} - {{ $summary = $item.Params.summary }} - {{ else if $item.Truncated }} - {{ $summary = $item.Summary }} - {{ end }} {{ with $summary }}
- {{ . | markdownify | emojify }} + {{ . }}
{{ end }} diff --git a/layouts/partials/project_li_list.html b/layouts/partials/project_li_list.html deleted file mode 100644 index dd739342..00000000 --- a/layouts/partials/project_li_list.html +++ /dev/null @@ -1,15 +0,0 @@ -{{ $item := .item }} -{{ $widget := .widget }} -{{ $link := .link }} -{{ $target := .target }} -{{ $js_tag_classes := delimit (apply (apply $item.Params.tags "replace" "." " " "-") "printf" "js-id-%s" ".") " " }} - -
- - - - - - - {{ with $item.Params.summary }}

{{ . | markdownify | emojify }}

{{ end }} -
diff --git a/layouts/partials/widgets/portfolio.html b/layouts/partials/widgets/portfolio.html index 84b0c21d..5769f6d1 100644 --- a/layouts/partials/widgets/portfolio.html +++ b/layouts/partials/widgets/portfolio.html @@ -68,19 +68,24 @@
{{ range $idx, $item := where site.RegularPages "Type" $items_type }} + {{ $link := $item.RelPermalink }} {{ $target := "" }} {{ if $item.Params.external_link }} {{ $link = $item.Params.external_link }} {{ $target = "target=\"_blank\" rel=\"noopener\"" }} {{ end }} + {{ if eq $st.Params.design.view 1 }} - {{ partial "project_li_list" (dict "widget" $st "index" $idx "item" $item "link" $link "target" $target) }} + {{ partial "portfolio_li_list" (dict "item" $item) }} + {{ else if eq $st.Params.design.view 2 }} + {{ partial "portfolio_li_compact" (dict "item" $item) }} {{ else if eq $st.Params.design.view 3 }} - {{ partial "project_li_card" (dict "widget" $st "index" $idx "item" $item "link" $link "target" $target) }} + {{ partial "portfolio_li_card" (dict "widget" $st "index" $idx "item" $item "link" $link "target" $target) }} {{ else }} - {{ partial "project_li_showcase" (dict "widget" $st "index" $idx "item" $item "link" $link "target" $target) }} + {{ partial "portfolio_li_showcase" (dict "widget" $st "index" $idx "item" $item "link" $link "target" $target) }} {{ end }} + {{ end }}