diff options
author | Francesco <tomaselli.fr@gmail.com> | 2025-05-16 19:34:51 +0200 |
---|---|---|
committer | Francesco <tomaselli.fr@gmail.com> | 2025-05-16 19:34:51 +0200 |
commit | ab3d2d785758aebf0da5a59c3aed6a172a71f59d (patch) | |
tree | b36dcf9b7ab9e4633be6cc7b8b7159f930ed04a6 | |
parent | 02934adef1e55ad9ce16f9eba62d96f69a39e401 (diff) |
Add author rendering
-rw-r--r-- | assets/css/main.css | 25 | ||||
-rw-r--r-- | layouts/_default/single.html | 40 | ||||
-rw-r--r-- | wiki/features/single-page-parameters.md | 10 | ||||
-rw-r--r-- | wiki/setup.md | 2 |
4 files changed, 60 insertions, 17 deletions
diff --git a/assets/css/main.css b/assets/css/main.css index 300bc16..9c4b39e 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -329,8 +329,28 @@ footer a { margin-bottom: .5rem; } -.single-readtime { - margin-top: .5rem; +.single-subsummary { + margin-top: calc(.8 * var(--p-margin-top)); + margin-bottom: var(--p-margin-bottom); + display: flex; + align-items: center; +} + +.single-subsummary img { + height: 45px; + width: 45px; + margin-right: .7rem; + border-radius: 50%; +} + +.author { + margin-bottom: 0; + margin-top: 0; +} + +.single-date { + margin-top: 0; + margin-bottom: 0; color: var(--content-secondary); } @@ -351,6 +371,7 @@ footer a { margin-right: .3rem; } + /* Single pagination */ .single-pagination { diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 209524e..01c35c2 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -15,21 +15,31 @@ {{- with .Param "summary" }} <p class="single-summary">{{ . | markdownify }}</p> {{- end }} - - {{- /* Reading Time */}} - - <p class="single-readtime"> - {{- with .Date }} - {{- $dateMachine := . | time.Format "2006-01-02T15:04:05-07:00" }} - {{- $dateHuman := . | time.Format (default ":date_long" $.Site.Params.singleDateFormat) }} - <time datetime="{{ $dateMachine }}">{{ $dateHuman }}</time> - {{- end }} - - {{- if .Param "readTime" }} - · - {{- .ReadingTime }} min read - {{- end }} - </p> + + {{- /* Date, Reading Time and Author */}} + <div class="single-subsummary"> + {{ with $.Param "authorAvatarPath" }} + <img src="{{ . }}" alt="Author Avatar" /> + {{ end }} + <div> + {{ with .Param "author" }} + <p class="author"> {{- .}} </p> + {{ end }} + <p class="single-date"> + {{- with .Date }} + {{- $dateMachine := . | time.Format "2006-01-02T15:04:05-07:00" }} + {{- $dateHuman := . | time.Format (default ":date_long" $.Site.Params.singleDateFormat) }} + <time datetime="{{ $dateMachine }}">{{ $dateHuman }}</time> + {{- end }} + + {{- if .Param "readTime" }} + · + {{- .ReadingTime }} min read + {{- end }} + </p> + </div> + </div> + </header> {{- if .Param "showTags" }} diff --git a/wiki/features/single-page-parameters.md b/wiki/features/single-page-parameters.md index 0bf62b0..8ebb3c6 100644 --- a/wiki/features/single-page-parameters.md +++ b/wiki/features/single-page-parameters.md @@ -12,6 +12,16 @@ showTags: false The following parameters apply to single pages, they are meant to be inserted in the `.md` files introductions, apart from the date format. +## Author + +You can specify an author name to display and avatar path to use. Here is an example +using an image from /static: + +```md +author: "Francesco" +authorAvatarPath: "/avatar.jpeg" +``` + ## Table of Contents Show a table of contents at the beginning of the post. diff --git a/wiki/setup.md b/wiki/setup.md index ef17db8..b93f21d 100644 --- a/wiki/setup.md +++ b/wiki/setup.md @@ -169,6 +169,8 @@ Sample post config. ```markdown --- title: "Log-Structured Merge Tree" +author: "Francesco" +authorAvatarPath: "/avatar.jpeg" date: "2023-11-12" summary: "An LSM Tree overview and Java implementation." description: "An LSM Tree overview and Java implementation." |