diff --git a/modules/blox-tailwind/layouts/_partials/badges/altmetric.html b/modules/blox-tailwind/layouts/_partials/badges/altmetric.html new file mode 100644 index 000000000..da746395a --- /dev/null +++ b/modules/blox-tailwind/layouts/_partials/badges/altmetric.html @@ -0,0 +1,69 @@ +{{/* + Altmetric badge embed + + Usage: + {{ partial "badges/altmetric" (dict "page" $page "is_list" $is_list) }} + + Config flags: + params.features.altmetric.enable: true|false + + Front matter options (any of following): + altmetric: true | "" | hugoblox.ids.altmetric + doi / hugoblox.ids.doi + arxiv_number | arxiv | eprint | hugoblox.ids.arxiv + pmid | isbn +*/}} + +{{ $enabled := site.Params.features.altmetric.enable | default true }} +{{ if not $enabled }}{{- return -}}{{ end }} + +{{ $page := .page }} + +{{/* Gather identifiers */}} +{{ $alt_val := $page.Params.altmetric }} +{{ $alt_str := printf "%v" $alt_val }} +{{ $has_explicit_alt_id := and $alt_val (ne (lower $alt_str) "true") }} +{{ $enabled_by_param := or (eq (lower $alt_str) "true") (eq $alt_val true) }} + +{{ $doi := $page.Params.doi | default "" }} +{{ $arxiv := or ($page.Params.arxiv_number | default "") ($page.Params.arxiv | default "") ($page.Params.eprint | default "") }} +{{ $pmid := $page.Params.pmid | default "" }} +{{ $isbn := $page.Params.isbn | default "" }} + +{{/* Support new HugoBlox IDs schema if present */}} +{{ $hb_ids := index $page.Params "hugoblox" "ids" }} +{{ with $hb_ids }} + {{ if and (not $doi) (index . "doi") }} + {{ $doi = index . "doi" }} + {{ end }} + {{ if and (not $arxiv) (index . "arxiv") }} + {{ $arxiv = index . "arxiv" }} + {{ end }} + {{ if and (not $pmid) (index . "pmid") }} + {{ $pmid = index . "pmid" }} + {{ end }} + {{ if and (not $isbn) (index . "isbn") }} + {{ $isbn = index . "isbn" }} + {{ end }} +{{ end }} + +{{/* Render only if enabled via altmetric param (true or explicit id) */}} +{{ if or $has_explicit_alt_id $enabled_by_param }} + + + + + +{{ end }} diff --git a/modules/blox-tailwind/layouts/_partials/badges/dimensions.html b/modules/blox-tailwind/layouts/_partials/badges/dimensions.html new file mode 100644 index 000000000..f3322a2c2 --- /dev/null +++ b/modules/blox-tailwind/layouts/_partials/badges/dimensions.html @@ -0,0 +1,65 @@ +{{/* + Dimensions badge embed + + Usage: + {{ partial "badges/dimensions" (dict "page" $page "is_list" $is_list) }} + + Config flags: + params.features.dimensions.enable: true|false + + Front matter options: + dimensions: true | "" + doi / hugoblox.ids.doi (fallback) + pmid / hugoblox.ids.pmid (fallback) +*/}} + +{{ $enabled := site.Params.features.dimensions.enable | default true }} +{{ if not $enabled }}{{- return -}}{{ end }} + +{{ $page := .page }} + +{{ $dim_val := $page.Params.dimensions }} +{{ $dim_str := printf "%v" $dim_val }} +{{ $has_explicit_dim_id := and $dim_val (ne (lower $dim_str) "true") (ne (lower $dim_str) "false") }} + +{{ $doi := $page.Params.doi | default "" }} +{{ $pmid := $page.Params.pmid | default "" }} + +{{/* Support new HugoBlox IDs schema if present */}} +{{ $hb_ids := index $page.Params "hugoblox" "ids" }} +{{ with $hb_ids }} + {{ if and (not $doi) (index . "doi") }} + {{ $doi = index . "doi" }} + {{ end }} + {{ if and (not $pmid) (index . "pmid") }} + {{ $pmid = index . "pmid" }} + {{ end }} +{{ end }} + +{{/* Determine explicit off switch */}} +{{ $has_param := isset $page.Params "dimensions" }} +{{ $is_disabled := and $has_param (or (eq (lower $dim_str) "false") (eq $dim_val false)) }} + +{{/* Render if: not disabled AND (explicit id OR enabled via param OR DOI/PMID available) */}} +{{ $enabled_by_param := or (eq (lower $dim_str) "true") (eq $dim_val true) }} +{{ if and (not $is_disabled) (or $has_explicit_dim_id (or $enabled_by_param (or $doi $pmid))) }} + + + + + + +{{ end }} diff --git a/modules/blox-tailwind/layouts/_partials/badges/inspire.html b/modules/blox-tailwind/layouts/_partials/badges/inspire.html new file mode 100644 index 000000000..ca2743b96 --- /dev/null +++ b/modules/blox-tailwind/layouts/_partials/badges/inspire.html @@ -0,0 +1,106 @@ +{{/* + InspireHEP citation count link + + Usage: + {{ partial "badges/inspire" (dict "page" $page "is_list" $is_list) }} + + Controlled by site param: + params.features.inspirehep.enable: true|false +*/}} + +{{ $enabled := site.Params.features.inspirehep.enable | default false }} +{{ if $enabled }} + + {{ $page := .page }} + {{ $doi := $page.Params.doi | default "" }} + {{ $arxiv := $page.Params.arxiv_number | default "" }} + {{ $inspire_id := $page.Params.inspirehep_id | default "" }} + {{/* Support new HugoBlox IDs schema if present */}} + {{ $hb_ids := index $page.Params "hugoblox" "ids" }} + {{ with $hb_ids }} + {{ if and (not $doi) (index . "doi") }} + {{ $doi = index . "doi" }} + {{ end }} + {{ if and (not $arxiv) (index . "arxiv") }} + {{ $arxiv = index . "arxiv" }} + {{ end }} + {{ if and (not $inspire_id) (or (index . "inspirehep") (index . "inspirehep_id") (index . "inspire")) }} + {{ $inspire_id = (or (index . "inspirehep") (index . "inspirehep_id") (index . "inspire")) }} + {{ end }} + {{ end }} + + {{ $q := "" }} + {{ if and $inspire_id (ne (printf "%v" $inspire_id) "") }} + {{/* Use explicit Inspire control number if provided */}} + {{ else if $doi }} + {{/* Prefer DOI when available */}} + {{ $q = printf "doi:%s" $doi }} + {{ else if $arxiv }} + {{ $q = printf "arxiv_eprints.value:%s" $arxiv }} + {{ end }} + + {{ if and $inspire_id (ne (printf "%v" $inspire_id) "") }} + {{ $api := printf "https://inspirehep.net/api/literature/%v?fields=citation_count,control_number" $inspire_id }} + {{ $data := dict }} + {{ with (resources.GetRemote $api) }} + {{ with ( . | transform.Unmarshal ) }} + {{ $data = . }} + {{ end }} + {{ end }} + {{ $meta := index $data "metadata" }} + {{ $count := index $meta "citation_count" }} + {{ $count_num := or $count 0 }} + {{ $count_str := printf "%d" (int $count_num) }} + {{/* Use the provided ID for the link to avoid float formatting */}} + {{ $cn_str := printf "%v" $inspire_id }} + {{ if $cn_str }} + {{ $inspire_url := printf "https://inspirehep.net/literature/%s" $cn_str }} + {{ $badge := site.Params.features.inspirehep.badge | default true }} + {{ if $badge }} + + {{ $count_str }} InspireHEP citations + + {{ else }} + + {{ partial "functions/get_icon" (dict "name" "link" "attributes" "style=\"height: 1em\" class='inline-block'") }} + Inspire citations: {{ $count_str }} + {{ partial "functions/get_icon" (dict "name" "arrow-top-right-on-square" "attributes" "style=\"height: 1em;\" class=\"inline-flex h-4 w-4 ml-1 align-text-top\"") }} + + {{ end }} + {{ end }} + {{ else if $q }} + {{ $api := printf "https://inspirehep.net/api/literature?q=%s&size=1&fields=control_number,citation_count" ($q | urlquery) }} + {{ $data := dict }} + {{ with (resources.GetRemote $api) }} + {{ with ( . | transform.Unmarshal ) }} + {{ $data = . }} + {{ end }} + {{ end }} + + {{ $hits := index $data "hits" "hits" }} + {{ if and $hits (gt (len $hits) 0) }} + {{ $meta := index $hits 0 "metadata" }} + {{ $count := index $meta "citation_count" }} + {{ $count_num := or $count 0 }} + {{ $count_str := printf "%d" (int $count_num) }} + {{ $cn := index $meta "control_number" }} + {{ $cn_str := printf "%d" (int $cn) }} + {{ if $cn_str }} + {{ $inspire_url := printf "https://inspirehep.net/literature/%s" $cn_str }} + {{ $badge := site.Params.features.inspirehep.badge | default true }} + {{ if $badge }} + + {{ $count_str }} InspireHEP citations + + {{ else }} + + {{ partial "functions/get_icon" (dict "name" "link" "attributes" "style=\"height: 1em\" class='inline-block'") }} + Inspire citations: {{ $count_str }} + {{ partial "functions/get_icon" (dict "name" "arrow-top-right-on-square" "attributes" "style=\"height: 1em;\" class=\"inline-flex h-4 w-4 ml-1 align-text-top\"") }} + + {{ end }} + {{ end }} + {{ end }} + {{ end }} + +{{ end }} diff --git a/modules/blox-tailwind/layouts/_partials/views/compact--end.html b/modules/blox-tailwind/layouts/_partials/views/compact--end.html new file mode 100644 index 000000000..b0f2d2fa7 --- /dev/null +++ b/modules/blox-tailwind/layouts/_partials/views/compact--end.html @@ -0,0 +1,2 @@ + + diff --git a/modules/blox-tailwind/layouts/_partials/views/compact--start.html b/modules/blox-tailwind/layouts/_partials/views/compact--start.html new file mode 100644 index 000000000..010f500da --- /dev/null +++ b/modules/blox-tailwind/layouts/_partials/views/compact--start.html @@ -0,0 +1,3 @@ +{{/* Full-width wrapper so the list can reflow on mobile. */}} +
+
diff --git a/modules/blox-tailwind/layouts/_partials/views/compact.html b/modules/blox-tailwind/layouts/_partials/views/compact.html new file mode 100755 index 000000000..0c2e68502 --- /dev/null +++ b/modules/blox-tailwind/layouts/_partials/views/compact.html @@ -0,0 +1,153 @@ +{{ $item := .item }} + + +{{ $show_authors_only := false }} +{{ $link := $item.RelPermalink }} + +{{ $target := "" }} +{{ if $item.Params.external_link }} + {{ $link = $item.Params.external_link }} + {{ $target = "target=\"_blank\" rel=\"noopener\"" }} +{{ end }} +{{ if or (eq $item.Type "event") (eq $item.Type "publication") (eq $item.Type "project") }} + {{ $show_authors_only = true }} +{{ end }} + +{{ $has_attachments := partial "functions/has_attachments" $item }} + +{{ $summary := "" }} +{{ if $item.Params.summary }} + {{ $summary = $item.Params.summary | markdownify | emojify }} +{{ else if $item.Params.abstract }} + {{ $summary = $item.Params.abstract | markdownify | emojify | truncate (site.Params.abstract_length | default 300) }} +{{ else if $item.Summary }} + {{ $summary = $item.Summary }} +{{ end }} + +
+
+
+ {{ if and $item.Params.tags (gt (len $item.Params.tags) 0) }} +
+ {{ with index ($item.GetTerms "tags") 0 }} + + + {{ .Page.LinkTitle }} + + + {{ end }} + {{ with $item.Params.event_type }} + {{ $vals := cond (reflect.IsSlice .) . (slice .) }} + {{ range $vals }} + {{ . }} + {{ end }} + {{ end }} + {{ with $item.Params.publication_short }} + {{ . }} + {{ end }} +
+ {{ end }} + + +

+ + {{ $item.Title }} + +

+ + {{ with $summary }} + +
+ {{ . }} + + {{ i18n "read_more" }} + + +
+
+ {{ end }} + +
+ {{ if eq $item.Type "event" }} +
+ + {{ partial "functions/get_event_dates" $item }} + + {{ with $item.Params.location }} + + {{ . }} + {{ end }} +
+ {{ end }} + {{ if eq $item.Type "publication" }} +
+ + {{ partial "functions/get_event_dates" $item }} + + {{ with $item.Params.publication }} + + {{ . | plainify}} + {{ end }} +
+ {{ end }} + + {{ if and $show_authors_only (ne $item.Type "event") $item.Params.authors }} +
+ {{ partial "page_metadata_authors" $item }} +
+ {{ else if not $show_authors_only }} +
+ + + +
+ {{ end }} +
+ + {{ if $has_attachments }} +
+ {{ partial "page_links" (dict "page" $item "is_list" 1) }} +
+ {{ end }} + + {{/* Publication badges below summary, above meta line */}} + {{ if eq $item.Type "publication" }} +
+ {{ partial "badges/altmetric" (dict "page" $item "is_list" 1) }} + {{ partial "badges/dimensions" (dict "page" $item "is_list" 1) }} + {{ partial "badges/inspire" (dict "page" $item "is_list" 1) }} +
+ {{ end }} + +
+
+ {{ $resource := partial "functions/get_featured_image.html" $item }} + {{ with $resource }} + {{ $image := .Resize "300x" }} + {{ if ne $image.MediaType.SubType "gif" }}{{ $image = $image.Process "webp" }}{{ end }} + + + {{ $item.Title | plainify }} featured image + + {{ end }} +
+
+
diff --git a/starters/academic-cv/config/_default/params.yaml b/starters/academic-cv/config/_default/params.yaml index 79a6d8227..6760920e9 100644 --- a/starters/academic-cv/config/_default/params.yaml +++ b/starters/academic-cv/config/_default/params.yaml @@ -58,3 +58,11 @@ features: enable: false privacy_pack: enable: false + inspirehep: + enable: true + badge: true + # prefer: doi | arxiv (currently DOI is preferred automatically when present) + altmetric: + enable: true + dimensions: + enable: true \ No newline at end of file diff --git a/starters/academic-cv/content/_index.md b/starters/academic-cv/content/_index.md index 5f943d8b2..66407a3f2 100644 --- a/starters/academic-cv/content/_index.md +++ b/starters/academic-cv/content/_index.md @@ -52,6 +52,16 @@ sections: design: view: article-grid columns: 2 + - block: collection + id: papers + content: + title: Featured Publications + filters: + folders: + - publication + featured_only: true + design: + view: compact - block: collection content: title: Recent Publications