From 37543a83e7accf892fe59b9b45cc18761aa2891f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Guibert?= Date: Tue, 10 Feb 2026 08:27:07 +0100 Subject: [PATCH] Flex layout done --- README.md | 9 ++++ assets/css/academic-contact.css | 30 ++++++++++++ assets/icons/email.svg | 17 +++++++ assets/icons/github.svg | 10 ++++ assets/icons/location.svg | 21 +++++++++ assets/icons/orcid.svg | 4 ++ assets/icons/scholar.svg | 1 + data/academic_contact.yaml | 15 ++++++ go.mod | 3 ++ layouts/partials/academic-contact.html | 64 ++++++++++++++++++++++++++ 10 files changed, 174 insertions(+) create mode 100644 README.md create mode 100644 assets/css/academic-contact.css create mode 100644 assets/icons/email.svg create mode 100755 assets/icons/github.svg create mode 100644 assets/icons/location.svg create mode 100644 assets/icons/orcid.svg create mode 100644 assets/icons/scholar.svg create mode 100644 data/academic_contact.yaml create mode 100644 go.mod create mode 100644 layouts/partials/academic-contact.html diff --git a/README.md b/README.md new file mode 100644 index 0000000..94e5002 --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +## Icons sources + +| Icon | Use | +| --- | --- | +| [ORCID](https://info.orcid.org/brand-guidelines/#General_brand_guidance) | CC0 license | +| [Google Scholar](https://commons.wikimedia.org/wiki/File:Google_Scholar_logo.svg) | No copyright? | +| [Github](https://brand.github.com/foundations/logo) | Autorised use | +| [Email](https://www.svgrepo.com/svg/157824/email) | CC0 license | +| [Location](https://www.svgrepo.com/svg/157869/placeholder) | CC0 license | diff --git a/assets/css/academic-contact.css b/assets/css/academic-contact.css new file mode 100644 index 0000000..5334d07 --- /dev/null +++ b/assets/css/academic-contact.css @@ -0,0 +1,30 @@ +.academic-contact { + display: flex; + flex-direction: row; + flex-wrap: nowrap; + justify-content: space-between; + align-items: center; +} + +.academic-contact .academic-contact-entry, +.academic-contact .academic-contact-entry a { + display: flex; + flex-direction: row; + flex-wrap: nowrap; + justify-content: space-between; +} + +.academic-contact .academic-contact-entry a { + text-decoration: none; +} + +.academic-contact .academic-contact-entry img { + max-width: 32px; + max-height: 32px; + min-width: 32px; + min-height: 32px; +} + +.academic-contact-value { + padding-left: 8px; +} \ No newline at end of file diff --git a/assets/icons/email.svg b/assets/icons/email.svg new file mode 100644 index 0000000..f79a196 --- /dev/null +++ b/assets/icons/email.svg @@ -0,0 +1,17 @@ + + + + + + + + + \ No newline at end of file diff --git a/assets/icons/github.svg b/assets/icons/github.svg new file mode 100755 index 0000000..4f46bf3 --- /dev/null +++ b/assets/icons/github.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/assets/icons/location.svg b/assets/icons/location.svg new file mode 100644 index 0000000..ff526df --- /dev/null +++ b/assets/icons/location.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/icons/orcid.svg b/assets/icons/orcid.svg new file mode 100644 index 0000000..375b457 --- /dev/null +++ b/assets/icons/orcid.svg @@ -0,0 +1,4 @@ + + + + diff --git a/assets/icons/scholar.svg b/assets/icons/scholar.svg new file mode 100644 index 0000000..7753830 --- /dev/null +++ b/assets/icons/scholar.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/data/academic_contact.yaml b/data/academic_contact.yaml new file mode 100644 index 0000000..292fa86 --- /dev/null +++ b/data/academic_contact.yaml @@ -0,0 +1,15 @@ +- type: location + value: Fribourg, CH + weight: 10 +- type: email + value: contact@loicguibert.ch + weight: 20 +- type: orcid + value: 0009-0002-1404-2546 + weight: 30 +- type: scholar + value: N7ZznXEAAAAJ + weight: 40 +- type: github + value: GuibertLo + weight: 60 \ No newline at end of file diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..c77d157 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module forge.guilo.ch/portfolio/hugo-academic-contact + +go 1.25.6 diff --git a/layouts/partials/academic-contact.html b/layouts/partials/academic-contact.html new file mode 100644 index 0000000..69eb46b --- /dev/null +++ b/layouts/partials/academic-contact.html @@ -0,0 +1,64 @@ +{{/* Get the resource from the module's assets folder */}} +{{ $css := resources.Get "css/academic-contact.css" }} + +{{/* Minify and Fingerprint for production */}} +{{ if hugo.IsProduction }} + {{ $css = $css | minify | fingerprint }} +{{ end }} + +{{/* Output the link tag */}} + + +
+ + {{ range sort (index .Site.Data.academic_contact) "weight" "asc" }} + + {{/* Removing link for location */}} + {{ if not (in .type "location") }} + + {{/* Building link for each type */}} + {{/* Initialize the variable */}} + {{ $baselink := "" }} + {{ if eq .type "email" }} + {{ $baselink = "mailto:" }} + {{ end }} + + {{ if eq .type "orcid" }} + {{ $baselink = "https://orcid.org/" }} {{/* Note: ORCID usually uses .org */}} + {{ end }} + + {{ if eq .type "scholar" }} + {{ $baselink = "https://scholar.google.com/citations?user=" }} + {{ end }} + + {{ if eq .type "github" }} + {{ $baselink = "https://github.com/" }} + {{ end }} + + + {{ end }} + + {{/* Capture the icon type for image name */}} + {{ $imageName := .type }} + + {{/* Construct the match pattern string */}} + {{ $pattern := printf "icons/%s*" $imageName }} + + {{/* Use the pattern to get the resource */}} + {{ $image := resources.GetMatch $pattern }} + + {{ with $image }} + {{/* Use .RelPermalink to get the actual dynamic URL */}} + {{ $imageName }} icon + {{ end }} + {{ if in .type "location" }} + {{ .value }} + {{ else }} + {{ .type | humanize }} + {{ end }} + {{ if not (in .type "location") }} + + {{ end}} + + {{ end }} +
\ No newline at end of file