From ab52b86a3b6270560e79c12e7b87b37229d79246 Mon Sep 17 00:00:00 2001 From: George Cushen Date: Tue, 19 Aug 2025 23:59:31 +0100 Subject: [PATCH] feat: standardize page resource links via `links` + `hugoblox.ids` Deprecates legacy fields Closes #765 - Add `modules/blox-tailwind/data/link_types.yaml` registry for link types and derived URLs - Add `layouts/_partials/functions/build_links.html` to normalize links (front matter, local pdf/cite.bib, `hugoblox.ids`, `projects`, `slides`), de-dupe, and warn on deprecated fields - Refactor `page_links.html` and `page_links_div.html` to render normalized links; use `icon: "pack/name"`; add English label fallbacks and new i18n keys - Migrate academic-cv starter: replace `external_link`/`url_*`, add SlideShare demo links, clear unresolved `slides` references --- modules/blox-tailwind/data/link_types.yaml | 150 ++++++++++ modules/blox-tailwind/i18n/en.yaml | 40 +++ .../_partials/functions/build_links.html | 259 ++++++++++++++++++ .../layouts/_partials/page_links.html | 225 +++++---------- .../layouts/_partials/page_links_div.html | 10 +- .../content/event/example/index.md | 20 +- .../content/project/pandas/index.md | 4 +- .../content/project/pytorch/index.md | 4 +- .../content/project/scikit/index.md | 4 +- .../publication/conference-paper/index.md | 33 ++- .../publication/journal-article/index.md | 35 ++- .../content/publication/preprint/index.md | 33 ++- 12 files changed, 599 insertions(+), 218 deletions(-) create mode 100644 modules/blox-tailwind/data/link_types.yaml create mode 100644 modules/blox-tailwind/layouts/_partials/functions/build_links.html diff --git a/modules/blox-tailwind/data/link_types.yaml b/modules/blox-tailwind/data/link_types.yaml new file mode 100644 index 00000000..57cd8670 --- /dev/null +++ b/modules/blox-tailwind/data/link_types.yaml @@ -0,0 +1,150 @@ +types: + pdf: + label_i18n: btn_pdf + icon: hero/document-text + preprint: + label_i18n: btn_preprint + icon: hero/document-text + doi: + label_i18n: btn_doi + icon: hero/link + code: + label_i18n: btn_code + icon: hero/code-bracket + dataset: + label_i18n: btn_dataset + icon: hero/circle-stack + model: + label_i18n: btn_model + icon: hero/link + slides: + label_i18n: btn_slides + icon: hero/presentation-chart-bar + video: + label_i18n: btn_video + icon: hero/video-camera + poster: + label_i18n: btn_poster + icon: hero/photo + project: + label_i18n: btn_project + icon: hero/link + site: + label_i18n: btn_site + icon: hero/link + source: + label_i18n: btn_source + icon: hero/document + bibtex: + label_i18n: btn_cite + icon: hero/document-duplicate + canonical: + label_i18n: btn_canonical + icon: hero/link + crosspost: + label_i18n: btn_crosspost + icon: hero/link + discussion: + label_i18n: btn_discussion + icon: hero/link + event: + label_i18n: btn_event + icon: hero/calendar + calendar: + label_i18n: btn_calendar + icon: hero/calendar + registration: + label_i18n: btn_registration + icon: hero/link + demo: + label_i18n: btn_demo + icon: hero/link + +# Mapping of identifier keys under `hugoblox.ids` to derived links +derived: + doi: + type: doi + label_i18n: btn_doi + icon: hero/link + url_template: "https://doi.org/{id}" + arxiv: + type: preprint + label_i18n: btn_preprint + icon: hero/document-text + url_template: "https://arxiv.org/abs/{id}" + openreview: + type: preprint + label_i18n: btn_preprint + icon: hero/document-text + url_template: "https://openreview.net/forum?id={id}" + acl_id: + type: source + label_i18n: btn_source + icon: hero/document + url_template: "https://aclanthology.org/{id}" + hal: + type: source + label_i18n: btn_hal + icon: hero/document + url_template: "https://hal.science/{id}" + dblp: + type: source + label_i18n: btn_dblp + icon: hero/document + url_template: "https://dblp.org/rec/{id}.html" + isbn: + type: source + label_i18n: btn_isbn + icon: hero/document + url_template: "https://openlibrary.org/isbn/{id}" + osf: + type: source + label_i18n: btn_osf + icon: hero/document + url_template: "https://osf.io/{id}" + zenodo: + type: source + label_i18n: btn_zenodo + icon: hero/document + url_template: "https://zenodo.org/records/{id}" + kaggle_dataset: + type: dataset + label_i18n: btn_kaggle + icon: hero/circle-stack + url_template: "https://www.kaggle.com/datasets/{id}" + kaggle_competition: + type: site + label_i18n: btn_kaggle + icon: hero/link + url_template: "https://www.kaggle.com/competitions/{id}" + openalex: + type: source + label_i18n: btn_openalex + icon: hero/document + url_template: "https://openalex.org/{id}" + semanticscholar: + type: source + label_i18n: btn_semanticscholar + icon: hero/document + url_template: "https://www.semanticscholar.org/paper/{id}" + pwc: + type: site + label_i18n: btn_pwc + icon: hero/link + url_template: "https://paperswithcode.com/paper/{id}" + huggingface_model: + type: model + label_i18n: btn_model + icon: hero/link + url_template: "https://huggingface.co/{id}" + huggingface_dataset: + type: dataset + label_i18n: btn_dataset + icon: hero/circle-stack + url_template: "https://huggingface.co/datasets/{id}" + huggingface_space: + type: demo + label_i18n: btn_demo + icon: hero/link + url_template: "https://huggingface.co/spaces/{id}" + diff --git a/modules/blox-tailwind/i18n/en.yaml b/modules/blox-tailwind/i18n/en.yaml index 07fb5f4c..4b89d06f 100644 --- a/modules/blox-tailwind/i18n/en.yaml +++ b/modules/blox-tailwind/i18n/en.yaml @@ -90,6 +90,46 @@ - id: btn_source translation: Source Document +# New link types +- id: btn_doi + translation: DOI +- id: btn_site + translation: Site +- id: btn_canonical + translation: Canonical +- id: btn_crosspost + translation: Crosspost +- id: btn_discussion + translation: Discussion +- id: btn_event + translation: Event +- id: btn_calendar + translation: Calendar +- id: btn_registration + translation: Registration +- id: btn_demo + translation: Demo +- id: btn_model + translation: Model +- id: btn_hal + translation: HAL +- id: btn_dblp + translation: DBLP +- id: btn_isbn + translation: ISBN +- id: btn_osf + translation: OSF +- id: btn_zenodo + translation: Zenodo +- id: btn_kaggle + translation: Kaggle +- id: btn_openalex + translation: OpenAlex +- id: btn_semanticscholar + translation: Semantic Scholar +- id: btn_pwc + translation: Papers With Code + - id: btn_copy translation: Copy diff --git a/modules/blox-tailwind/layouts/_partials/functions/build_links.html b/modules/blox-tailwind/layouts/_partials/functions/build_links.html new file mode 100644 index 00000000..5bb95c23 --- /dev/null +++ b/modules/blox-tailwind/layouts/_partials/functions/build_links.html @@ -0,0 +1,259 @@ +{{/* + Hugo Blox Page Link Builder + Build a normalized list of page links from: + - Author-provided front matter `links` (array order respected) + - Auto-detected resources (local PDF, cite.bib) + - Derived identifiers from `hugoblox.ids` + - Associated internal `projects` references + + Inputs: dict { "page": . , "is_list": 0|1 } + Output: slice of dicts with fields: type, url, icon, labelKey, label, contexts, rel + + Deprecations handled with warnings and mapped: + - external_link -> type: site + - url_pdf -> type: pdf + - url_preprint -> type: preprint + - url_code -> type: code + - url_dataset -> type: dataset + - url_poster -> type: poster + - url_project -> type: project + - url_slides -> type: slides + - url_source -> type: source + - url_video -> type: video +*/}} + +{{ $page := .page }} +{{ $is_list := .is_list }} + +{{ $types := site.Data.link_types.types }} +{{ $derived := site.Data.link_types.derived }} + +{{ $links := slice }} +{{ $seen := newScratch }} +{{ $seen.Set "set" (dict) }} + +{{/* 1) Author-provided links (array order) */}} +{{ with $page.Params.links }} + {{ range . }} + {{/* Support new fields: type, url, icon (pack/name), label, contexts, rel; legacy: name */}} + {{ $type := .type | default "custom" }} + {{ $url := .url | default "" }} + {{/* Optional provider+id derivation for common platforms */}} + {{ if and (not $url) .id }} + {{ if eq $type "doi" }} + {{ $url = replace (index (index $derived "doi") "url_template") "{id}" (printf "%v" .id) }} + {{ else if and (eq $type "preprint") (eq .provider "arxiv") }} + {{ $url = replace (index (index $derived "arxiv") "url_template") "{id}" (printf "%v" .id) }} + {{ else if and (eq $type "preprint") (eq .provider "openreview") }} + {{ $url = replace (index (index $derived "openreview") "url_template") "{id}" (printf "%v" .id) }} + {{ end }} + {{ end }} + {{ $typeF := $type }} + {{ $urlF := $url }} + {{ $keyF := printf "%s::%s" $typeF $urlF }} + {{ if not ($seen.Get (printf "set.%s" $keyF)) }} + {{ $seen.SetInMap "set" $keyF true }} + {{ $links = $links | append (dict + "type" $typeF + "url" $urlF + "icon" (.icon | default (index (index $types $typeF) "icon") | default "hero/link") + "labelKey" (index (index $types $typeF) "label_i18n") + "label" (.label | default .name) + "contexts" (.contexts | default (slice "list" "page")) + "rel" .rel + ) }} + {{ end }} + {{ end }} +{{ end }} + +{{/* 2) Associated projects (internal) */}} +{{ with $page.Params.projects }} + {{ range . }} + {{ with (site.GetPage (printf "project/%s" .)) }} + {{ $typeF := "project" }} + {{ $urlF := .RelPermalink }} + {{ $keyF := printf "%s::%s" $typeF $urlF }} + {{ if not ($seen.Get (printf "set.%s" $keyF)) }} + {{ $seen.SetInMap "set" $keyF true }} + {{ $links = $links | append (dict + "type" $typeF + "url" $urlF + "icon" (index (index $types $typeF) "icon") + "labelKey" (index (index $types $typeF) "label_i18n") + "contexts" (slice "list" "page") + ) }} + {{ end }} + {{ end }} + {{ end }} +{{ end }} + +{{/* 2b) Slides relation parameter (legacy but common) */}} +{{ with $page.Params.slides }} + {{ with (site.GetPage (printf "slides/%s" .)) }} + {{ $typeF := "slides" }} + {{ $urlF := .RelPermalink }} + {{ $keyF := printf "%s::%s" $typeF $urlF }} + {{ if not ($seen.Get (printf "set.%s" $keyF)) }} + {{ $seen.SetInMap "set" $keyF true }} + {{ $links = $links | append (dict + "type" $typeF + "url" $urlF + "icon" (index (index $types $typeF) "icon") + "labelKey" (index (index $types $typeF) "label_i18n") + "contexts" (slice "list" "page") + ) }} + {{ end }} + {{ else }} + {{ warnf "`slides` relation could not resolve to a page for %s" $page.File.Path }} + {{ end }} +{{ end }} + +{{/* 3) Auto-detected resources (local PDF by content basename, cite.bib) */}} +{{ with $page.File.ContentBaseName }} + {{ with ($page.Resources.GetMatch (printf "%s.pdf" .)) }} + {{ $typeF := "pdf" }} + {{ $urlF := .RelPermalink }} + {{ $keyF := printf "%s::%s" $typeF $urlF }} + {{ if not ($seen.Get (printf "set.%s" $keyF)) }} + {{ $seen.SetInMap "set" $keyF true }} + {{ $links = $links | append (dict + "type" $typeF + "url" $urlF + "icon" (index (index $types $typeF) "icon") + "labelKey" (index (index $types $typeF) "label_i18n") + "contexts" (slice "list" "page") + ) }} + {{ end }} + {{ end }} +{{ end }} +{{ with ($page.Resources.GetMatch "cite.bib") }} + {{ $typeF := "bibtex" }} + {{ $urlF := .RelPermalink }} + {{ $keyF := printf "%s::%s" $typeF $urlF }} + {{ if not ($seen.Get (printf "set.%s" $keyF)) }} + {{ $seen.SetInMap "set" $keyF true }} + {{ $links = $links | append (dict + "type" $typeF + "url" $urlF + "icon" (index (index $types $typeF) "icon") + "labelKey" (index (index $types $typeF) "label_i18n") + "contexts" (slice "list" "page") + ) }} + {{ end }} +{{ end }} + +{{/* 4) Derived links from identifiers under `hugoblox.ids` */}} +{{ with $page.Params.hugoblox }} + {{ with .ids }} + {{ range $key, $val := . }} + {{ with (index $derived $key) }} + {{ $der := . }} + {{ $typeF := index $der "type" }} + {{ $urlF := replace (index $der "url_template") "{id}" (printf "%v" $val) }} + {{ $keyF := printf "%s::%s" $typeF $urlF }} + {{ if not ($seen.Get (printf "set.%s" $keyF)) }} + {{ $seen.SetInMap "set" $keyF true }} + {{ $links = $links | append (dict + "type" $typeF + "url" $urlF + "icon" (index $der "icon") + "labelKey" (index $der "label_i18n") + "contexts" (slice "list" "page") + ) }} + {{ end }} + {{ end }} + {{ end }} + {{ end }} +{{ end }} + +{{/* 5) Legacy fields -> deprecation warnings and normalized items */}} +{{/* external_link */}} +{{ with $page.Params.external_link }} + {{ warnf "`external_link` is deprecated. Use `links: [{type: site, url: ...}]` in %s" $page.File.Path }} + {{ $typeF := "site" }} + {{ $urlF := . }} + {{ $keyF := printf "%s::%s" $typeF $urlF }} + {{ if not ($seen.Get (printf "set.%s" $keyF)) }} + {{ $seen.SetInMap "set" $keyF true }} + {{ $links = $links | append (dict + "type" $typeF + "url" $urlF + "icon" (index (index $types $typeF) "icon") + "labelKey" (index (index $types $typeF) "label_i18n") + "contexts" (slice "list" "page") + ) }} + {{ end }} +{{ end }} +{{/* top-level doi */}} +{{ with $page.Params.doi }} + {{ warnf "Top-level `doi` is deprecated. Use `hugoblox.ids: { doi: ... }` in %s" $page.File.Path }} + {{ with (index $derived "doi") }} + {{ $der := . }} + {{ $typeF := index $der "type" }} + {{ $urlF := replace (index $der "url_template") "{id}" (printf "%v" $page.Params.doi) }} + {{ $keyF := printf "%s::%s" $typeF $urlF }} + {{ if not ($seen.Get (printf "set.%s" $keyF)) }} + {{ $seen.SetInMap "set" $keyF true }} + {{ $links = $links | append (dict + "type" $typeF + "url" $urlF + "icon" (index $der "icon") + "labelKey" (index $der "label_i18n") + "contexts" (slice "list" "page") + ) }} + {{ end }} + {{ else }} + {{ $typeF := "doi" }} + {{ $urlF := printf "https://doi.org/%v" $page.Params.doi }} + {{ $keyF := printf "%s::%s" $typeF $urlF }} + {{ if not ($seen.Get (printf "set.%s" $keyF)) }} + {{ $seen.SetInMap "set" $keyF true }} + {{ $links = $links | append (dict + "type" $typeF + "url" $urlF + "icon" (index (index $types $typeF) "icon") + "labelKey" (index (index $types $typeF) "label_i18n") + "contexts" (slice "list" "page") + ) }} + {{ end }} + {{ end }} +{{ end }} +{{/* Map of legacy url_* to new types */}} +{{ $legacy := dict + "url_pdf" "pdf" + "url_preprint" "preprint" + "url_code" "code" + "url_dataset" "dataset" + "url_poster" "poster" + "url_project" "project" + "url_slides" "slides" + "url_source" "source" + "url_video" "video" +}} +{{ range $legacyKey, $legacyType := $legacy }} + {{ with index $page.Params $legacyKey }} + {{ warnf "`%s` is deprecated. Use `links: [{type: %s, url: ...}]` in %s" $legacyKey $legacyType $page.File.Path }} + {{/* Resolve relative resource if present */}} + {{ $u := . }} + {{ with ($page.Resources.GetMatch $u) }} + {{ $u = .RelPermalink }} + {{ else }} + {{ $u = $u | relURL }} + {{ end }} + {{ $typeF := $legacyType }} + {{ $urlF := $u }} + {{ $keyF := printf "%s::%s" $typeF $urlF }} + {{ if not ($seen.Get (printf "set.%s" $keyF)) }} + {{ $seen.SetInMap "set" $keyF true }} + {{ $links = $links | append (dict + "type" $typeF + "url" $urlF + "icon" (index (index $types $typeF) "icon") + "labelKey" (index (index $types $typeF) "label_i18n") + "contexts" (slice "list" "page") + ) }} + {{ end }} + {{ end }} +{{ end }} + +{{- return $links -}} diff --git a/modules/blox-tailwind/layouts/_partials/page_links.html b/modules/blox-tailwind/layouts/_partials/page_links.html index 45d48f18..c5af40a4 100644 --- a/modules/blox-tailwind/layouts/_partials/page_links.html +++ b/modules/blox-tailwind/layouts/_partials/page_links.html @@ -1,167 +1,74 @@ {{ $is_list := .is_list }} {{ $page := .page }} -{{ $link := "" }} -{{/* ***** TODO: Deprecate `url_preprint` in favour of `url_pdf` given there's now a dedicated "Preprint" pub. type. ***** */}} -{{ with $page.Params.url_preprint }} - {{ $resource := $page.Resources.GetMatch . }} - {{ if $resource }} - {{ $link = $resource.RelPermalink }} - {{ else }} - {{ $link = . | relURL }} - {{ end }} - - {{ i18n "btn_preprint" }} - -{{ end }} -{{ $pdf := "" }} -{{ $resource := $page.Resources.GetMatch (printf "%s.pdf" $page.File.ContentBaseName) }} -{{ with $resource }} - {{ $pdf = .RelPermalink }} -{{ else }} - {{ if $page.Params.url_pdf }} - {{ $pdf = $page.Params.url_pdf | relURL }} - {{ end }} -{{ end }} +{{/* Build normalized links (new API) */}} +{{ $built := partial "functions/build_links" (dict "page" $page "is_list" $is_list) }} -{{ with $pdf }} - - {{ partial "functions/get_icon" (dict "name" "document-text" "attributes" "style=\"height: 1em\" class='inline-block'") }} - {{ i18n "btn_pdf" }} - -{{ end }} -{{ $resource := $page.Resources.GetMatch "cite.bib" }} -{{ with $resource }} - -{{ end }} -{{ with $page.Params.url_code }} - {{ $resource := $page.Resources.GetMatch . }} - {{ if $resource }} - {{ $link = $resource.RelPermalink }} - {{ else }} - {{ $link = . | relURL }} - {{ end }} - - {{ partial "functions/get_icon" (dict "name" "code-bracket" "attributes" "style=\"height: 1em\" class='inline-block'") }} - {{ i18n "btn_code" }} - -{{ end }} -{{ with $page.Params.url_dataset }} - {{ $resource := $page.Resources.GetMatch . }} - {{ if $resource }} - {{ $link = $resource.RelPermalink }} - {{ else }} - {{ $link = . | relURL }} - {{ end }} - - {{ partial "functions/get_icon" (dict "name" "circle-stack" "attributes" "style=\"height: 1em\" class='inline-block'") }} - {{ i18n "btn_dataset" }} - -{{ end }} -{{ if $page.Params.projects }} -{{ range $page.Params.projects }} - {{ with (site.GetPage (printf "project/%s" .)) }} - - {{ i18n "btn_project" }} - - {{ else }} - {{/* errorf "The `projects` parameter in `content/%s` references a project file, `content/project/%s`, which cannot be found. Please either set `projects = []` or fix the reference." $page.File.Path . */}} - {{ end }} -{{ end }} -{{ else }} -{{ with $page.Params.url_project }} - - {{ i18n "btn_project" }} - -{{ end }} -{{ end }} -{{ with $page.Params.url_poster }} - {{ $resource := $page.Resources.GetMatch . }} - {{ if $resource }} - {{ $link = $resource.RelPermalink }} - {{ else }} - {{ $link = . | relURL }} - {{ end }} - - {{ partial "functions/get_icon" (dict "name" "photo" "attributes" "style=\"height: 1em\" class='inline-block'") }} - {{ i18n "btn_poster" }} - -{{ end }} -{{ if $page.Params.slides }} - {{ with (site.GetPage (printf "slides/%s" $page.Params.slides)) }} - - {{ partial "functions/get_icon" (dict "name" "presentation-chart-bar" "attributes" "style=\"height: 1em\" class='inline-block'") }} - {{ i18n "btn_slides" }} - - {{ end }} -{{ else }} -{{ with $page.Params.url_slides }} - {{ $resource := $page.Resources.GetMatch . }} - {{ if $resource }} - {{ $link = $resource.RelPermalink }} - {{ else }} - {{ $link = . | relURL }} - {{ end }} - - {{ partial "functions/get_icon" (dict "name" "presentation-chart-bar" "attributes" "style=\"height: 1em\" class='inline-block'") }} - {{ i18n "btn_slides" }} - -{{ end }} -{{ end }} -{{ with $page.Params.url_video }} - {{ $resource := $page.Resources.GetMatch . }} - {{ if $resource }} - {{ $link = $resource.RelPermalink }} - {{ else }} - {{ $link = . | relURL }} - {{ end }} - - {{ partial "functions/get_icon" (dict "name" "video-camera" "attributes" "style=\"height: 1em\" class='inline-block'") }} - {{ i18n "btn_video" }} - -{{ end }} -{{ with $page.Params.url_source }} - {{ $resource := $page.Resources.GetMatch . }} - {{ if $resource }} - {{ $link = $resource.RelPermalink }} - {{ else }} - {{ $link = . | relURL }} - {{ end }} - - {{ partial "functions/get_icon" (dict "name" "document" "attributes" "style=\"height: 1em\" class='inline-block'") }} - {{ i18n "btn_source" }} - -{{ end }} -{{ with $page.Params.doi }} - - DOI - -{{ end }} -{{ range $page.Params.links }} - {{ $pack := or .icon_pack "fas" }} - {{ $pack_prefix := $pack }} - {{ if in (slice "fab" "fas" "far" "fal") $pack }} - {{ $pack_prefix = "fa" }} - {{ end }} - {{ $link := .url | default "" }} - {{ $scheme := (urls.Parse $link).Scheme }} - {{ $target := "" }} - {{ if not $scheme }} - {{ $resource := $page.Resources.GetMatch $link }} - {{ if $resource }} - {{ $link = $resource.RelPermalink }} +{{ $ctx := cond $is_list "list" "page" }} + +{{/* English fallbacks if i18n key is missing in a locale */}} +{{ $fallbackByKey := dict + "btn_pdf" "PDF" + "btn_preprint" "Preprint" + "btn_doi" "DOI" + "btn_code" "Code" + "btn_dataset" "Dataset" + "btn_model" "Model" + "btn_slides" "Slides" + "btn_video" "Video" + "btn_poster" "Poster" + "btn_project" "Project" + "btn_site" "Site" + "btn_source" "Source Document" + "btn_canonical" "Canonical" + "btn_crosspost" "Crosspost" + "btn_discussion" "Discussion" + "btn_event" "Event" + "btn_calendar" "Calendar" + "btn_registration" "Registration" + "btn_demo" "Demo" + "btn_cite" "Cite" +}} + +{{ range $built }} + {{ if in .contexts $ctx }} + {{ $url := .url | default "" }} + {{ $scheme := (urls.Parse $url).Scheme }} + {{ $target := "" }} + {{ $rel := slice }} + {{ with .rel }}{{ $rel = . }}{{ end }} + {{ if not $scheme }} + {{ with ($page.Resources.GetMatch $url) }} + {{ $url = .RelPermalink }} + {{ else }} + {{ $url = $url | relURL }} + {{ end }} + {{ else if in (slice "http" "https") $scheme }} + {{ $target = "target=\"_blank\"" }} + {{ $rel = $rel | append "noopener" }} + {{ end }} + + {{ $classes := printf "hb-attachment-link %s" (cond $is_list "hb-attachment-link-small" "hb-attachment-link-large") }} + {{ $label := .label }} + {{ with .labelKey }} + {{ if not $label }} + {{ $label = (i18n .) | default (index $fallbackByKey .) | default "Link" }} + {{ end }} + {{ end }} + {{ if not $label }} + {{ $label = "Link" }} + {{ end }} + + {{ if eq .type "bibtex" }} + {{ else }} - {{ $link = $link | relURL }} + + {{ partial "functions/get_icon" (dict "name" (.icon | default "hero/link") "attributes" "style=\"height: 1em\" class='inline-block'") }} + {{ $label }} + {{ end }} - {{ else if in (slice "http" "https") $scheme }} - {{ $target = "target=\"_blank\" rel=\"noopener\"" }} {{ end }} - - {{ partial "functions/get_icon" (dict "name" "link" "attributes" "style=\"height: 1em\" class='inline-block'") }} - {{ if .icon }}{{end}} - {{- with .name }}{{ . | safeHTML }}{{ end -}} - {{ end }} diff --git a/modules/blox-tailwind/layouts/_partials/page_links_div.html b/modules/blox-tailwind/layouts/_partials/page_links_div.html index 5dad96f0..dcb8bb02 100644 --- a/modules/blox-tailwind/layouts/_partials/page_links_div.html +++ b/modules/blox-tailwind/layouts/_partials/page_links_div.html @@ -1,12 +1,8 @@ -{{/* Div wrapper around page links. */}} -{{/* The wrapper is hidden when the page has no link buttons. */}} +{{/* Div wrapper around page links. Hidden if page has no links. */}} -{{ $has_attachments := partial "functions/has_attachments" . }} -{{ if $has_attachments | or .Params.external_link }} +{{ $built := partial "functions/build_links" (dict "page" . "is_list" 0) }} +{{ if gt (len $built) 0 }}
- {{ with .Params.external_link }} - {{ i18n "open_project_site" }} - {{ end }} {{ partial "page_links" (dict "page" . "is_list" 0) }}
{{ end }} diff --git a/starters/academic-cv/content/event/example/index.md b/starters/academic-cv/content/event/example/index.md index b68f9e70..c61a5137 100644 --- a/starters/academic-cv/content/event/example/index.md +++ b/starters/academic-cv/content/event/example/index.md @@ -36,15 +36,13 @@ image: caption: 'Image credit: [**Unsplash**](https://unsplash.com/photos/bzdhc5b3Bxs)' focal_point: Right -#links: -# - icon: twitter -# icon_pack: fab -# name: Follow -# url: https://twitter.com/georgecushen -url_code: 'https://github.com' -url_pdf: '' -url_slides: 'https://slideshare.net' -url_video: 'https://youtube.com' +links: + - type: code + url: https://github.com + - type: slides + url: https://slideshare.net + - type: video + url: https://youtube.com # Markdown Slides (optional). # Associate this talk with Markdown slides. @@ -68,8 +66,8 @@ Click on the **Slides** button above to view the built-in slides feature. Slides can be added in a few ways: -- **Create** slides using Hugo Blox Builder's [_Slides_](https://docs.hugoblox.com/reference/content-types/) feature and link using `slides` parameter in the front matter of the talk file -- **Upload** an existing slide deck to `static/` and link using `url_slides` parameter in the front matter of the talk file +- **Create** slides using Hugo Blox Builder's [_Slides_](https://docs.hugoblox.com/reference/content-types/) feature and link using the `slides` parameter in the front matter of the talk file +- **Upload** an existing slide deck to this page bundle and link it using `links: [{ type: slides, url: path/to/file } ]` in front matter - **Embed** your slides (e.g. Google Slides) or presentation video on this page using [shortcodes](https://docs.hugoblox.com/reference/markdown/). Further event details, including [page elements](https://docs.hugoblox.com/reference/markdown/) such as image galleries, can be added to the body of this page. diff --git a/starters/academic-cv/content/project/pandas/index.md b/starters/academic-cv/content/project/pandas/index.md index 28b279b5..a7b1cb30 100644 --- a/starters/academic-cv/content/project/pandas/index.md +++ b/starters/academic-cv/content/project/pandas/index.md @@ -1,7 +1,9 @@ --- title: Pandas date: 2023-10-26 -external_link: https://github.com/pandas-dev/pandas +links: + - type: site + url: https://github.com/pandas-dev/pandas tags: - Hugo - Wowchemy diff --git a/starters/academic-cv/content/project/pytorch/index.md b/starters/academic-cv/content/project/pytorch/index.md index 9ae18e6f..c6b9800a 100644 --- a/starters/academic-cv/content/project/pytorch/index.md +++ b/starters/academic-cv/content/project/pytorch/index.md @@ -1,7 +1,9 @@ --- title: PyTorch date: 2023-10-26 -external_link: https://github.com/pytorch/pytorch +links: + - type: site + url: https://github.com/pytorch/pytorch tags: - Hugo - Wowchemy diff --git a/starters/academic-cv/content/project/scikit/index.md b/starters/academic-cv/content/project/scikit/index.md index fa208ef0..f63d1b42 100644 --- a/starters/academic-cv/content/project/scikit/index.md +++ b/starters/academic-cv/content/project/scikit/index.md @@ -1,7 +1,9 @@ --- title: scikit-learn date: 2023-10-26 -external_link: https://github.com/scikit-learn/scikit-learn +links: + - type: site + url: https://github.com/scikit-learn/scikit-learn tags: - Hugo - Wowchemy diff --git a/starters/academic-cv/content/publication/conference-paper/index.md b/starters/academic-cv/content/publication/conference-paper/index.md index fc8d850c..90b04efe 100644 --- a/starters/academic-cv/content/publication/conference-paper/index.md +++ b/starters/academic-cv/content/publication/conference-paper/index.md @@ -14,7 +14,6 @@ author_notes: - 'Equal contribution' date: '2013-07-01T00:00:00Z' -doi: '' # Schedule page publish date (NOT publication's date). publishDate: '2017-01-01T00:00:00Z' @@ -39,19 +38,25 @@ tags: # Display this page in the Featured widget? featured: true -# Custom links (uncomment lines below) -# links: -# - name: Custom Link -# url: http://example.org +# Standard identifiers for auto-linking +hugoblox: + ids: + doi: 10.5555/123456 -url_pdf: '' -url_code: 'https://github.com/HugoBlox/hugo-blox-builder' -url_dataset: 'https://github.com/HugoBlox/hugo-blox-builder' -url_poster: '' -url_project: '' -url_slides: '' -url_source: 'https://github.com/HugoBlox/hugo-blox-builder' -url_video: 'https://youtube.com' +# Custom links +links: + - type: pdf + url: "" + - type: code + url: https://github.com/HugoBlox/hugo-blox-builder + - type: dataset + url: https://github.com/HugoBlox/hugo-blox-builder + - type: slides + url: https://www.slideshare.net/ + - type: source + url: https://github.com/HugoBlox/hugo-blox-builder + - type: video + url: https://youtube.com # Featured image # To use, add an image named `featured.jpg/png` to your page's folder. @@ -73,7 +78,7 @@ projects: # Simply enter your slide deck's filename without extension. # E.g. `slides: "example"` references `content/slides/example/index.md`. # Otherwise, set `slides: ""`. -slides: example +slides: "" --- {{% callout note %}} diff --git a/starters/academic-cv/content/publication/journal-article/index.md b/starters/academic-cv/content/publication/journal-article/index.md index 079228aa..9dbb33a8 100644 --- a/starters/academic-cv/content/publication/journal-article/index.md +++ b/starters/academic-cv/content/publication/journal-article/index.md @@ -7,7 +7,6 @@ author_notes: - "Equal contribution" - "Equal contribution" date: "2015-09-01T00:00:00Z" -doi: "" # Schedule page publish date (NOT publication's date). publishDate: "2017-01-01T00:00:00Z" @@ -30,17 +29,27 @@ tags: - Source Themes featured: false -# links: -# - name: "" -# url: "" -url_pdf: http://arxiv.org/pdf/1512.04133v1 -url_code: 'https://github.com/HugoBlox/hugo-blox-builder' -url_dataset: '' -url_poster: '' -url_project: '' -url_slides: '' -url_source: '' -url_video: '' +hugoblox: + ids: + arxiv: 1512.04133v1 + +links: + - type: pdf + url: http://arxiv.org/pdf/1512.04133v1 + - type: code + url: https://github.com/HugoBlox/hugo-blox-builder + - type: dataset + url: "" + - type: poster + url: "" + - type: project + url: "" + - type: slides + url: https://www.slideshare.net/ + - type: source + url: "" + - type: video + url: "" # Featured image # To use, add an image named `featured.jpg/png` to your page's folder. @@ -61,7 +70,7 @@ projects: [] # Simply enter your slide deck's filename without extension. # E.g. `slides: "example"` references `content/slides/example/index.md`. # Otherwise, set `slides: ""`. -slides: example +slides: "" --- {{% callout note %}} diff --git a/starters/academic-cv/content/publication/preprint/index.md b/starters/academic-cv/content/publication/preprint/index.md index 5c9ad1ed..6132e000 100644 --- a/starters/academic-cv/content/publication/preprint/index.md +++ b/starters/academic-cv/content/publication/preprint/index.md @@ -3,7 +3,6 @@ title: "An example preprint / working paper" authors: - admin date: "2019-04-07T00:00:00Z" -doi: "" # Schedule page publish date (NOT publication's date). publishDate: "2017-01-01T00:00:00Z" @@ -27,17 +26,29 @@ tags: featured: true +hugoblox: + ids: + arxiv: 1512.04133v1 + links: -- name: Custom Link +- type: preprint + provider: arxiv + id: 1512.04133v1 +- type: code + url: https://github.com/HugoBlox/hugo-blox-builder +- type: slides + url: https://www.slideshare.net/ +- type: dataset + url: "#" +- type: poster + url: "#" +- type: source + url: "#" +- type: video + url: https://youtube.com +- type: custom + label: Custom Link url: http://example.org -url_pdf: http://arxiv.org/pdf/1512.04133v1 -url_code: 'https://github.com/HugoBlox/hugo-blox-builder' -url_dataset: '#' -url_poster: '#' -url_project: '' -url_slides: '' -url_source: '#' -url_video: '#' # Featured image # To use, add an image named `featured.jpg/png` to your page's folder. @@ -59,7 +70,7 @@ projects: # Simply enter your slide deck's filename without extension. # E.g. `slides: "example"` references `content/slides/example/index.md`. # Otherwise, set `slides: ""`. -slides: example +slides: "" --- This work is driven by the results in my [previous paper](/publication/conference-paper/) on LLMs.