mirror of
https://github.com/tiennm99/HugoBlox-kit.git
synced 2026-10-12 16:15:12 +00:00
refactor: move old widgets to v1/ dir
Prevent conflicts with new v2 landing page block system See #2049
This commit is contained in:
1 parent
340662423f
commit
0b624e2eff
17 files changed
+114
-5
No files matched your search
@@ -10,7 +10,7 @@
|
||||
{{ if .author }}
|
||||
{{ $author = .author }}
|
||||
{{ else }}
|
||||
{{ $author = $block.Params.author | default $block.content.username }}
|
||||
{{ $author = $block.content.username }}
|
||||
{{end}}
|
||||
|
||||
{{ $person_page_path := (printf "/authors/%s" $author) }}
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
{{/* Initialise */}}
|
||||
{{ $page := .wcPage }}
|
||||
{{ $block := .wcBlock }}
|
||||
{{ $columns := $block.Params.design.columns | default $block.design.columns | default "2" }}
|
||||
{{ $text := $block.Content | default ($block.content.text | emojify | markdownify) }}
|
||||
{{ $columns := $block.design.columns | default "2" }}
|
||||
{{ $text := $block.content.text | emojify | markdownify }}
|
||||
|
||||
{{ if ne $columns "1" }}
|
||||
<div class="col-12 col-lg-8">
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
{{/* Wowchemy Blocks: About - avatar variation */}}
|
||||
{{/* 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.Params.author }}
|
||||
{{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" }}
|
||||
|
||||
<div id="profile">
|
||||
|
||||
{{ if $avatar }}
|
||||
<div class="avatar-wrapper">
|
||||
{{ $avatar_image := $avatar.Fill "150x150 Center" }}
|
||||
<img class="avatar {{if eq $avatar_shape "square"}}avatar-square{{else}}avatar-circle{{end}}" src="{{ $avatar_image.RelPermalink }}" alt="{{$person_page.Title}}"
|
||||
width="{{ $avatar_image.Width }}" height="{{ $avatar_image.Height }}">
|
||||
{{with $person.status.icon}}<span class="avatar-emoji">{{.|emojify}}</span>{{end}}
|
||||
</div>
|
||||
{{ 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 }}
|
||||
{{ if eq (path.Ext $link) ".pdf" }}{{ $target = "target=\"_blank\" rel=\"noopener\"" }}{{ end }}
|
||||
{{ else if in (slice "http" "https") $scheme }}
|
||||
{{ $target = "target=\"_blank\" rel=\"noopener\"" }}
|
||||
{{ end }}
|
||||
<li>
|
||||
<a href="{{ $link | safeURL }}" {{ $target | safeHTMLAttr }} aria-label="{{ .icon }}"
|
||||
{{ with .label }} data-toggle="tooltip" data-placement="top" title="{{.}}"{{ end }}>
|
||||
<i class="{{ $pack }} {{ $pack_prefix }}-{{ .icon }} big-icon"></i>
|
||||
</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
|
||||
{{ with $block.Content }}
|
||||
<div class="article-style pt-1">
|
||||
{{ . }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
</div>
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,18 @@
|
||||
{{/* Wowchemy Blocks: Markdown */}}
|
||||
{{/* Documentation: https://wowchemy.com/blocks/ */}}
|
||||
{{/* License: https://github.com/wowchemy/wowchemy-hugo-themes/blob/main/LICENSE.md */}}
|
||||
|
||||
{{/* Initialise */}}
|
||||
{{ $page := .wcPage }}
|
||||
{{ $block := .wcBlock }}
|
||||
{{ $columns := $block.Params.design.columns | default "2" }}
|
||||
|
||||
{{ if ne $columns "1" }}
|
||||
<div class="col-12 col-lg-8">
|
||||
{{ $block.Content }}
|
||||
</div>
|
||||
{{ else }}
|
||||
<div class="col-12">
|
||||
{{ $block.Content }}
|
||||
</div>
|
||||
{{ end }}
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+1
-1
@@ -10,7 +10,7 @@
|
||||
{{ if eq $block_type "featurette" }}{{ $block_type = "features" }}{{ end }}{{/* Support legacy Featurette block */}}
|
||||
{{ if eq $block_type "pages" }}{{ $block_type = "collection" }}{{ end }}{{/* Support legacy Pages block */}}
|
||||
{{ if eq $block_type "featured" }}{{ $block_type = "collection" }}{{ end }}{{/* Support legacy Featured block */}}
|
||||
{{ $widget_path := printf "blocks/%s.html" $block_type }}
|
||||
{{ $widget_path := printf "blocks/v1/%s.html" $block_type }}
|
||||
{{ if not (templates.Exists (printf "partials/%s" $widget_path)) }}
|
||||
{{ errorf "%s uses a `%s` block but the `%s` block was not found at `layouts/partials/%s`" $block.File.Path $block_type $block_type $widget_path }}
|
||||
{{ end }}
|
||||
@@ -28,5 +28,5 @@
|
||||
|
||||
{{/* Load Wowchemy blocks */}}
|
||||
{{ range $index, $block := where ( $headless_bundle.Resources.ByType "page" ) ".Params.active" "!=" false }}
|
||||
{{ partial "functions/parse_block" (dict "page" $ "block" $block) }}
|
||||
{{ partial "functions/parse_block_v1" (dict "page" $ "block" $block) }}
|
||||
{{ end }}
|
||||
Reference in new issue
Block a user