Add author bio to article footer

pull/26/head
James Panther 2021-11-04 10:54:47 +11:00
parent 3a2ce6a9e0
commit 4fa7aa4c77
No known key found for this signature in database
GPG Key ID: D36F789E45745D17
7 changed files with 19 additions and 3 deletions

View File

@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- KaTeX support using `katex` shortcode - KaTeX support using `katex` shortcode
- Dark mode toggle with new theme parameters for managing light/dark appearance - Dark mode toggle with new theme parameters for managing light/dark appearance
- French translation ([#18](https://github.com/jpanther/congo/pull/18)) - French translation ([#18](https://github.com/jpanther/congo/pull/18))
- Author bio in article footer
- Grouping by year can now be specificed in front matter on list pages - Grouping by year can now be specificed in front matter on list pages
### Changed ### Changed

View File

@ -2088,6 +2088,10 @@ body a, body button {
justify-content: space-between; justify-content: space-between;
} }
.place-self-center {
place-self: center;
}
.overflow-hidden { .overflow-hidden {
overflow: hidden; overflow: hidden;
} }
@ -2586,6 +2590,10 @@ body a, body button {
color: var(--color-neutral-300); color: var(--color-neutral-300);
} }
.dark .dark\:text-neutral-400 {
color: var(--color-neutral-400);
}
.dark .dark\:text-primary-400 { .dark .dark\:text-primary-400 {
color: var(--color-primary-400); color: var(--color-primary-400);
} }

View File

@ -17,6 +17,7 @@ summaryLength = 0
[author] [author]
# name = "Your name here" # name = "Your name here"
# image = "img/author.jpg" # image = "img/author.jpg"
# bio = "A little bit about you"
# links = [ # links = [
# { email = "mailto:hello@your_domain.com" }, # { email = "mailto:hello@your_domain.com" },
# { link = "https://link-to-some-website.com/" }, # { link = "https://link-to-some-website.com/" },

View File

@ -17,6 +17,7 @@ summaryLength = 0
[author] [author]
name = "Congo" name = "Congo"
image = "img/author.jpg" image = "img/author.jpg"
bio = "This is an example author bio, and although there's a stock photo of a dog here, this article was actually created by a human. :dog:"
links = [ links = [
{ twitter = "https://twitter.com/" }, { twitter = "https://twitter.com/" },
{ facebook = "https://facebook.com/" }, { facebook = "https://facebook.com/" },

View File

@ -41,6 +41,7 @@ Note that the variable names provided in this table use dot notation to simplify
|`summaryLength`|integer|`0`|The number of words that are used to generate the article summary when one is not provided in the [front matter]({{< ref "front-matter" >}}). A value of `0` will use the first sentence. This value has no effect when summaries are hidden.| |`summaryLength`|integer|`0`|The number of words that are used to generate the article summary when one is not provided in the [front matter]({{< ref "front-matter" >}}). A value of `0` will use the first sentence. This value has no effect when summaries are hidden.|
|`author.name`|string|_Not set_|The author's name. This will be displayed in article footers, and on the homepage when the profile layout is used.| |`author.name`|string|_Not set_|The author's name. This will be displayed in article footers, and on the homepage when the profile layout is used.|
|`author.image`|string|_Not set_|Path to the image file of the author. The image should be a 1:1 aspect ratio and placed in the site's `static/` folder.| |`author.image`|string|_Not set_|Path to the image file of the author. The image should be a 1:1 aspect ratio and placed in the site's `static/` folder.|
|`author.bio`|string|_Not set_|A Markdown string containing the author's bio. It will be displayed in article footers.|
|`author.links`|array of objects|_Not set_|The links to display alongside the author's details. The config file contains example links which can simply be uncommented to enable. The order that the links are displayed is determined by the order they appear in the array. Custom links can be added by providing corresponding SVG icon assets in `assets/icons/`.| |`author.links`|array of objects|_Not set_|The links to display alongside the author's details. The config file contains example links which can simply be uncommented to enable. The order that the links are displayed is determined by the order they appear in the array. Custom links can be added by providing corresponding SVG icon assets in `assets/icons/`.|
|`permalinks`||_Not set_|Refer to the [Hugo docs](https://gohugo.io/content-management/urls/#permalinks) for permalink configuration.| |`permalinks`||_Not set_|Refer to the [Hugo docs](https://gohugo.io/content-management/urls/#permalinks) for permalink configuration.|
|`taxonomies`||_Not set_|Refer to the [Organising content]({{< ref "getting-started#organising-content" >}}) section for taxonomy configuration.| |`taxonomies`||_Not set_|Refer to the [Organising content]({{< ref "getting-started#organising-content" >}}) section for taxonomy configuration.|

View File

@ -23,8 +23,9 @@ languageCode = "en-AU"
title = "My awesome website" title = "My awesome website"
[author] [author]
name = "Your name" name = "My name"
image = "img/author.jpg" image = "img/author.jpg"
bio = "A little bit about me"
links = [ links = [
{ twitter = "https://twitter.com/username" } { twitter = "https://twitter.com/username" }
] ]

View File

@ -1,9 +1,9 @@
{{ if .Params.showAuthor | default (.Site.Params.article.showAuthor | default true) }} {{ if .Params.showAuthor | default (.Site.Params.article.showAuthor | default true) }}
<div class="flex items-center"> <div class="flex">
{{ with .Site.Author.image }} {{ with .Site.Author.image }}
<img class="w-24 h-24 !mt-0 !mb-0 mr-4 rounded-full" src="{{ . | relURL }}" /> <img class="w-24 h-24 !mt-0 !mb-0 mr-4 rounded-full" src="{{ . | relURL }}" />
{{ end }} {{ end }}
<div> <div class="place-self-center">
{{ with .Site.Author.name | markdownify | emojify }} {{ with .Site.Author.name | markdownify | emojify }}
<div class="text-[0.6rem] leading-3 text-neutral-400 dark:text-neutral-500 uppercase"> <div class="text-[0.6rem] leading-3 text-neutral-400 dark:text-neutral-500 uppercase">
{{ i18n "author.byline_title" | markdownify | emojify }} {{ i18n "author.byline_title" | markdownify | emojify }}
@ -12,6 +12,9 @@
{{ . }} {{ . }}
</div> </div>
{{ end }} {{ end }}
{{ with .Site.Author.bio | markdownify | emojify }}
<div class="text-sm text-neutral-700 dark:text-neutral-400">{{ . }}</div>
{{ end }}
{{ partialCached "author-links.html" . }} {{ partialCached "author-links.html" . }}
</div> </div>
</div> </div>