Files
HugoBlox-kit/layouts/partials/widgets/projects.html
T
George Cushen 7c2a85c351 feat: improve listings
- link author profile pages in listings
- display author name (rather than username) in metadata
- refactor `list_format` to `view` and use new consistent mappings
- add `citation_style` in `params.toml`
- re-order Accomplishments widget in Demo
- make params/comments more consistent in all widget front matter
- Author page: don't show username if profile exists as that will
  already show the user's display name
- Publication card: move author and publication name to metadata bar to
  be consistent with other listings
- Remove portrait.jpg from static as it was duplicated for Demo author

BREAKING CHANGES: See issue below.

See #909
2019-02-04 22:14:28 +00:00

86 lines
3.5 KiB
HTML

{{ $ := .root }}
{{ $page := .page }}
<!-- Projects widget -->
{{ $widget_layout := $page.Params.widget_layout | default 0 }}
{{ if eq $widget_layout 0 }}
{{/* Standard dual-column layout. */}}
<div class="row">
<div class="col-xs-12 col-md-4 section-heading">
<h1>{{ with $page.Title }}{{ . | markdownify }}{{ end }}</h1>
{{ with $page.Params.subtitle }}<p>{{ . | markdownify }}</p>{{ end }}
</div>
<div class="col-xs-12 col-md-8">
{{ else }}
{{/* Single column layout. */}}
<div class="margin-auto">
<div class="center-text">
{{ with $page.Title }}<h1 class="mt-0">{{ . | markdownify }}</h1>{{ end }}
{{ with $page.Params.subtitle }}<p>{{ . | markdownify }}</p>{{ end }}
</div>
<div>
{{ end }}
{{ with $page.Content }}<p>{{ . | markdownify }}</p>{{ end }}
{{ if $page.Params.filter }}
{{ $filter_default := default (int $page.Params.filter_default) 0 }}
{{/* Parse default filter tag from front matter in the form of either tag name or CSS class name. */}}
{{ $default_filter_tag_raw := (index $page.Params.filter ($filter_default)).tag }}
{{ $default_filter_tag := printf ".js-id-%s" (replace $default_filter_tag_raw " " "-") }}
{{ if or (eq (substr $default_filter_tag_raw 0 1) "*") (eq (substr $default_filter_tag_raw 0 1) ".") }}
{{ $default_filter_tag = $default_filter_tag_raw }}
{{ end }}
<span class="d-none default-project-filter">{{ $default_filter_tag }}</span>
{{/* Only show filter buttons if there are multiple filters. */}}
{{ if gt (len $page.Params.filter) 1 }}
<div class="project-toolbar">
<div class="project-filters">
<div class="btn-toolbar">
<div class="btn-group flex-wrap">
{{ range $idx, $item := $page.Params.filter }}
{{/* Parse filter tag from front matter in the form of either tag name or CSS class name. */}}
{{ $data_filter := printf ".js-id-%s" (replace .tag " " "-") }}
{{ if or (eq (substr .tag 0 1) "*") (eq (substr .tag 0 1) ".") }}
{{ $data_filter = .tag }}
{{ end }}
<a href="#" data-filter="{{ $data_filter | safeHTMLAttr }}" class="btn btn-primary btn-lg{{ if eq $idx $filter_default }} active{{ end }}">{{ .name }}</a>
{{ end }}
</div>
</div>
</div>
</div>
{{ end }}
{{ end }}
<div class="row {{ if or $page.Params.filter (eq $page.Params.view 1) }}isotope projects-container{{end}} {{if eq $page.Params.view 1}}js-layout-masonry{{else}}js-layout-row{{end}} {{ if eq $page.Params.view 2 }}project-showcase mt-5{{end}}">
{{ range $idx, $item := where $.Site.RegularPages "Type" ($page.Params.folder | default "project") }}
{{ $link := $item.RelPermalink }}
{{ $target := "" }}
{{ if $item.Params.external_link }}
{{ $link = $item.Params.external_link }}
{{ $target = "target=\"_blank\" rel=\"noopener\"" }}
{{ end }}
{{ if eq $page.Params.view 1 }}
{{ partial "project_li_list" (dict "widget" $page "index" $idx "item" $item "link" $link "target" $target) }}
{{ else if eq $page.Params.view 3 }}
{{ partial "project_li_card" (dict "widget" $page "index" $idx "item" $item "link" $link "target" $target) }}
{{ else }}
{{ partial "project_li_showcase" (dict "widget" $page "index" $idx "item" $item "link" $link "target" $target) }}
{{ end }}
{{ end }}
</div>
</div>
</div>