mirror of
https://github.com/tiennm99/HugoBlox-kit.git
synced 2026-10-12 18:15:31 +00:00
feat: add Biography block to v2 block collection
To use, reference as: `about.biography` Close #2925
This commit is contained in:
1 parent
c329e54a1e
commit
951c7b6f70
2 files changed
+135
-1
No files matched your search
@@ -56,7 +56,7 @@ ul.network-icon {
|
||||
}
|
||||
|
||||
#profile .network-icon {
|
||||
margin-top: 30px;
|
||||
margin-top: 0.5rem;
|
||||
}
|
||||
|
||||
.network-icon li {
|
||||
|
||||
@@ -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" }}
|
||||
|
||||
<!-- About widget -->
|
||||
<div class="row">
|
||||
<div class="col-12 col-lg-4">
|
||||
<div id="profile">
|
||||
|
||||
{{ if site.Params.features.avatar.gravatar }}
|
||||
<img class="avatar {{if eq $avatar_shape "square"}}avatar-square{{else}}avatar-circle{{end}}" src="https://s.gravatar.com/avatar/{{ md5 $person.email }}?s=270')" alt="{{$person_page.Title}}">
|
||||
{{ else if $avatar }}
|
||||
{{ $avatar_image := $avatar.Fill "270x270 Center" }}
|
||||
<img class="avatar {{if eq $avatar_shape "square"}}avatar-square{{else}}avatar-circle{{end}}"
|
||||
width="{{ $avatar_image.Width }}" height="{{ $avatar_image.Height }}"
|
||||
src="{{ $avatar_image.RelPermalink }}" alt="{{$person_page.Title}}">
|
||||
{{ end }}
|
||||
|
||||
<div class="portrait-title">
|
||||
|
||||
<h2>
|
||||
{{- if $person.name_pronunciation -}}
|
||||
<ruby>
|
||||
<rb>{{ $person_page.Title }}</rb>
|
||||
<rt>{{ $person.name_pronunciation }}</rt>
|
||||
</ruby>
|
||||
{{- else -}}
|
||||
{{- $person_page.Title -}}
|
||||
{{- end -}}
|
||||
</h2>
|
||||
|
||||
{{ with $person.role }}<h3>{{ . | markdownify | emojify }}</h3>{{ end }}
|
||||
|
||||
{{ range $person.organizations }}
|
||||
<h3>
|
||||
{{ with .url }}<a href="{{ . }}" target="_blank" rel="noopener">{{ end }}
|
||||
<span>{{ .name }}</span>
|
||||
{{ if .url }}</a>{{ end }}
|
||||
</h3>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
<ul class="network-icon" aria-hidden="true">
|
||||
{{ range $person.social }}
|
||||
{{ $pack := or .icon_pack "fas" }}
|
||||
{{ $pack_prefix := $pack }}
|
||||
{{ if in (slice "fab" "fas" "far" "fal") $pack }}
|
||||
{{ $pack_prefix = "fa" }}
|
||||
{{ end }}
|
||||
{{ $link := .link }}
|
||||
{{ $scheme := (urls.Parse $link).Scheme }}
|
||||
{{ $target := "" }}
|
||||
{{ if not $scheme }}
|
||||
{{ $link = .link | relLangURL }}
|
||||
{{ else if in (slice "http" "https") $scheme }}
|
||||
{{ $target = "target=\"_blank\" rel=\"noopener\"" }}
|
||||
{{ end }}
|
||||
<li>
|
||||
<a href="{{ $link | safeURL }}" {{ $target | safeHTMLAttr }} aria-label="{{ .icon }}">
|
||||
<i class="{{ $pack }} {{ $pack_prefix }}-{{ .icon }} big-icon"></i>
|
||||
</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-lg-8">
|
||||
|
||||
{{/* Only display widget title in explicit instances of about widget, not in author pages. */}}
|
||||
{{ with $block.content.title }}<h1>{{ . | markdownify | emojify }}</h1>{{ end }}
|
||||
|
||||
{{ with $person_page.Content }}
|
||||
<div class="article-style">
|
||||
{{ . }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
<div class="row">
|
||||
|
||||
{{ with $person.interests }}
|
||||
<div class="col-md-5">
|
||||
<div class="section-subheading">{{ i18n "interests" | markdownify }}</div>
|
||||
<ul class="ul-interests fa-ul mb-0">
|
||||
{{ range . }}
|
||||
<li>
|
||||
<i class="fa-li fa-solid fa-book"></i>
|
||||
{{ . | markdownify | emojify }}
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ with $person.education }}
|
||||
<div class="col-md-7">
|
||||
<div class="section-subheading">{{ i18n "education" | markdownify }}</div>
|
||||
<ul class="ul-edu fa-ul mb-0">
|
||||
{{ range .courses }}
|
||||
<li>
|
||||
<i class="fa-li fa-solid fa-graduation-cap"></i>
|
||||
<div class="description">
|
||||
<p class="course">{{ .course }}{{ with .year }}, {{ . }}{{ end }}</p>
|
||||
<p class="institution">{{ .institution }}</p>
|
||||
</div>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Reference in new issue
Block a user