diff --git a/CHANGELOG.md b/CHANGELOG.md index d7e737d..414b7b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### Added +- New `profile` shortcode - Umami Analytics support ([#832](https://github.com/jpanther/congo/pull/832)) - Theme parameter to set a default HTML theme colour ([#849](https://github.com/jpanther/congo/pull/849)) - New icon for `bluesky` ([#851](https://github.com/jpanther/congo/pull/851)) diff --git a/assets/css/compiled/main.css b/assets/css/compiled/main.css index 5d18fa1..9a8d2af 100644 --- a/assets/css/compiled/main.css +++ b/assets/css/compiled/main.css @@ -2162,6 +2162,10 @@ code { align-items: flex-start; } +.items-end { + align-items: flex-end; +} + .items-center { align-items: center; } diff --git a/exampleSite/content/docs/shortcodes/index.md b/exampleSite/content/docs/shortcodes/index.md index f3c43fe..bd58e56 100644 --- a/exampleSite/content/docs/shortcodes/index.md +++ b/exampleSite/content/docs/shortcodes/index.md @@ -234,3 +234,23 @@ B-->C[Profit] {{< /mermaid >}} You can see some additional Mermaid examples on the [diagrams and flowcharts samples]({{< ref "diagrams-flowcharts" >}}) page. + +## Profile + +The `profile` shortcode inserts a block displaying the site author's details. The same template is used on Congo's homepage layouts, but can also be inserted in any article content. It has one optional parameter: + + +|Parameter|Description| +|---|---| +|`align`|The alignment of the profile elements - valid options include `start`, `center` and `end`. If no value is provided, the `center` alignment will be used.| + + +The template is populated using the author parameters set in the [Language Configuration]({{< ref "configuration#configuration" >}}). + +**Example:** + +```md +{{}} +``` + +{{< profile align="center" >}} diff --git a/layouts/partials/author-links.html b/layouts/partials/author-links.html index d193fd8..cbcd33a 100644 --- a/layouts/partials/author-links.html +++ b/layouts/partials/author-links.html @@ -1,4 +1,4 @@ -{{ with .Site.Language.Params.Author.links }} +{{ with site.Language.Params.Author.links }}
{{ range $links := . }} {{ range $name, $url := $links }} diff --git a/layouts/partials/home/profile.html b/layouts/partials/home/profile.html index 2c35228..26c496e 100644 --- a/layouts/partials/home/profile.html +++ b/layouts/partials/home/profile.html @@ -3,28 +3,7 @@ h-full {{ end }} flex flex-col items-center justify-center text-center" > -
- {{ $lazy := .Params.enableImageLazyLoading | default .Site.Params.enableImageLazyLoading | default true }} - {{ $altText := ($.Site.Language.Params.Author.name | default "Author") }} - {{ with .Site.Language.Params.Author.image }} - {{ $authorImage := resources.Get . }} - {{ if $authorImage }} - {{ $imgClass := "mb-2 h-auto w-36 rounded-full" }} - {{ partial "picture.html" (dict "img" $authorImage "alt" $altText "class" $imgClass "lazy" $lazy) }} - {{ end }} - {{ end }} -

- {{ .Site.Language.Params.Author.name | default .Site.Title }} -

- {{ with .Site.Language.Params.Author.headline }} -

- {{ . | markdownify | emojify }} -

- {{ end }} -
- {{ partialCached "author-links.html" . }} -
-
+ {{ partial "profile.html" }}
{{ .Content | emojify }}
diff --git a/layouts/partials/profile.html b/layouts/partials/profile.html new file mode 100644 index 0000000..cf0331f --- /dev/null +++ b/layouts/partials/profile.html @@ -0,0 +1,31 @@ +{{ $align := .align | default "center" }} +
+ {{ $lazy := site.Params.enableImageLazyLoading | default true }} + {{ $altText := (site.Language.Params.Author.name | default "Author") }} + {{ with site.Language.Params.Author.image }} + {{ $authorImage := resources.Get . }} + {{ if $authorImage }} + {{ $imgClass := "mb-2 h-auto w-36 rounded-full" }} + {{ partial "picture.html" (dict "img" $authorImage "alt" $altText "class" $imgClass "lazy" $lazy) }} + {{ end }} + {{ end }} +

+ {{ site.Language.Params.Author.name | default site.Title }} +

+ {{ with site.Language.Params.Author.headline }} +

+ {{ . | markdownify | emojify }} +

+ {{ end }} +
+ {{ partialCached "author-links.html" . }} +
+
diff --git a/layouts/shortcodes/profile.html b/layouts/shortcodes/profile.html new file mode 100644 index 0000000..e5b0b02 --- /dev/null +++ b/layouts/shortcodes/profile.html @@ -0,0 +1,2 @@ +{{ $align := default "center" (.Get "align") }} +{{ partial "profile.html" (dict "align" $align) }}