Add headline parameter and image resizing

This commit is contained in:
James Panther 2022-06-17 11:56:39 +10:00
parent 5ae1a23727
commit e2dd72d0be
No known key found for this signature in database
GPG Key ID: D36F789E45745D17
6 changed files with 24 additions and 3 deletions

View File

@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Support for new author `headline` parameter
- Automatic author image resizing when image is provided as a Hugo asset
- Alt text to author image ([#8](https://github.com/jpanther/lynx/pull/8))
- Expanded Emoji support in page titles

View File

@ -10,6 +10,7 @@ disableKinds = ["taxonomy", "term"]
[author]
# name = "Your name here"
# headline = "An awesome person"
# image = "img/author.jpg" # path relative to static directory
links = [

View File

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View File

@ -6,6 +6,7 @@ disableKinds = ["taxonomy", "term"]
[author]
name = "Lynx"
headline = "A simple links theme for Hugo built with Tailwind CSS"
image = "author.jpg"
links = [
{ link = { href = "https://github.com/jpanther/lynx/blob/stable/README.md", text = "View the readme", icon = "github" } },

View File

@ -2,4 +2,4 @@
description: "This is a demo of the Lynx theme for Hugo."
---
A simple links theme for Hugo built with Tailwind CSS.
View the readme or check out all the link styles available using the links below.

View File

@ -2,15 +2,32 @@
<article class="flex flex-col items-center justify-center h-full mt-10 text-center">
<header class="flex flex-col items-center mb-3">
{{ with .Site.Author.image }}
{{ $src := . }}
{{ $resource := "" }}
{{ if $.Page.Resources.GetMatch $src }}
{{ $resource = $.Page.Resources.GetMatch $src }}
{{ else if resources.GetMatch $src }}
{{ $resource = resources.Get $src }}
{{ end }}
{{ with $resource }}
{{ $src = (.Fill "288x288").RelPermalink }}
{{ end }}
<img
class="mb-2 rounded-full w-36 h-36"
src="{{ . | relURL }}"
alt="{{ $.Site.Author.name }}"
width="144"
height="144"
alt="{{ $.Site.Author.name | default "Author" }}"
src="{{ $src }}"
/>
{{ end }}
<h1 class="text-4xl font-extrabold dark:text-white">
{{ .Params.title | default .Site.Author.name | default .Site.Title | emojify }}
</h1>
{{ with .Site.Author.headline }}
<h2 class="text-xl text-neutral-500 dark:text-neutral-400">
{{ . | markdownify | emojify }}
</h2>
{{ end }}
{{ with .Content }}
<section class="pt-5 prose dark:prose-invert">{{ . | emojify }}</section>
{{ end }}