From 951c7b6f709d420580d545c1610f8bb3399593f5 Mon Sep 17 00:00:00 2001 From: George Cushen Date: Thu, 20 Apr 2023 21:57:46 +0100 Subject: [PATCH] feat: add Biography block to v2 block collection To use, reference as: `about.biography` Close #2925 --- .../assets/scss/wowchemy/widgets/_about.scss | 2 +- .../partials/blocks/about.biography.html | 134 ++++++++++++++++++ 2 files changed, 135 insertions(+), 1 deletion(-) create mode 100644 modules/wowchemy/layouts/partials/blocks/about.biography.html diff --git a/modules/wowchemy/assets/scss/wowchemy/widgets/_about.scss b/modules/wowchemy/assets/scss/wowchemy/widgets/_about.scss index 3f75c098..bab13970 100644 --- a/modules/wowchemy/assets/scss/wowchemy/widgets/_about.scss +++ b/modules/wowchemy/assets/scss/wowchemy/widgets/_about.scss @@ -56,7 +56,7 @@ ul.network-icon { } #profile .network-icon { - margin-top: 30px; + margin-top: 0.5rem; } .network-icon li { diff --git a/modules/wowchemy/layouts/partials/blocks/about.biography.html b/modules/wowchemy/layouts/partials/blocks/about.biography.html new file mode 100644 index 00000000..ea3d95bb --- /dev/null +++ b/modules/wowchemy/layouts/partials/blocks/about.biography.html @@ -0,0 +1,134 @@ +{{/* Wowchemy Blocks: About */}} +{{/* Documentation: https://wowchemy.com/blocks/ */}} +{{/* License: https://github.com/wowchemy/wowchemy-hugo-themes/blob/main/LICENSE.md */}} + +{{/* Initialise */}} +{{ $page := .wcPage }} +{{ $block := .wcBlock }} + +{{ $author := "" }} +{{ if .author }} + {{ $author = .author }} +{{ else }} + {{ $author = $block.content.username }} +{{end}} + +{{ $person_page_path := (printf "/authors/%s" $author) }} +{{ $person_page := site.GetPage $person_page_path }} +{{ if not $person_page }} + {{ errorf "Could not find an author page at `%s`. Please check the value of `author` in your About widget and create an associated author page if one does not already exist. See https://wowchemy.com/docs/page-builder/#about " $person_page_path }} +{{end}} +{{ $person := $person_page.Params }} +{{ $avatar := ($person_page.Resources.ByType "image").GetMatch "*avatar*" }} +{{ $avatar_shape := site.Params.features.avatar.shape | default "circle" }} + + +
+
+
+ + {{ if site.Params.features.avatar.gravatar }} + {{$person_page.Title}} + {{ else if $avatar }} + {{ $avatar_image := $avatar.Fill "270x270 Center" }} + {{$person_page.Title}} + {{ end }} + +
+ +

+ {{- if $person.name_pronunciation -}} + + {{ $person_page.Title }} + {{ $person.name_pronunciation }} + + {{- else -}} + {{- $person_page.Title -}} + {{- end -}} +

+ + {{ with $person.role }}

{{ . | markdownify | emojify }}

{{ end }} + + {{ range $person.organizations }} +

+ {{ with .url }}{{ end }} + {{ .name }} + {{ if .url }}{{ end }} +

+ {{ end }} +
+ + + +
+
+
+ + {{/* Only display widget title in explicit instances of about widget, not in author pages. */}} + {{ with $block.content.title }}

{{ . | markdownify | emojify }}

{{ end }} + + {{ with $person_page.Content }} +
+ {{ . }} +
+ {{ end }} + +
+ + {{ with $person.interests }} +
+
{{ i18n "interests" | markdownify }}
+
    + {{ range . }} +
  • + + {{ . | markdownify | emojify }} +
  • + {{ end }} +
+
+ {{ end }} + + {{ with $person.education }} +
+
{{ i18n "education" | markdownify }}
+
    + {{ range .courses }} +
  • + +
    +

    {{ .course }}{{ with .year }}, {{ . }}{{ end }}

    +

    {{ .institution }}

    +
    +
  • + {{ end }} +
+
+ {{ end }} + +
+
+