Merge pull request #1659 from insidemordecai/dev

 Add 'Reply by Email' feature
This commit is contained in:
Nuno Coração 2024-08-10 11:04:04 +01:00 committed by GitHub
commit 32af8f189a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 16 additions and 0 deletions

View file

@ -15,6 +15,7 @@ title = "Blowfish"
# [author]
# name = "Your name here"
# email = "youremail@example.com"
# image = "img/blowfish_logo.png"
# imageQuality = 96
# headline = "I'm only human"

View file

@ -12,6 +12,8 @@ autoSwitchAppearance = true
enableSearch = true
enableCodeCopy = false
replyByEmail = false
# mainSections = ["section1", "section2"]
# robots = ""

View file

@ -140,6 +140,7 @@ The default file can be used as a template to create additional languages, or re
| Name | Default | Description |
| --------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `author.name` | _Not set_ | The author's name. This will be displayed in article footers, and on the homepage when the profile layout is used. |
| `author.email` | _Not set_ | The author's email. This will be used if the reply-via-email functionality is enabled. |
| `author.image` | _Not set_ | Path to the image file of the author. The image should be a 1:1 aspect ratio. The image can be placed in the site's `assets/` folder or can be external url. |
| `author.imageQuality` | `96` | The author's image file will be treated as a "high quality" image to minimize artifacts on the front page. Value range 1-100. |
| `author.headline` | _Not set_ | A Markdown string containing the author's headline. It will be displayed on the profile homepage under the author's name. |
@ -172,6 +173,7 @@ Many of the article defaults here can be overridden on a per article basis by sp
| `autoSwitchAppearance` | `true` | Whether the theme appearance automatically switches based upon the visitor's operating system preference. Set to `false` to force the site to always use the `defaultAppearance`. |
| `enableSearch` | `false` | Whether site search is enabled. Set to `true` to enable search functionality. Note that the search feature depends on the `outputs.home` setting in the [site configuration](#site-configuration) being set correctly. |
| `enableCodeCopy` | `false` | Whether copy-to-clipboard buttons are enabled for `<code>` blocks. The `highlight.noClasses` parameter must be set to `false` for code copy to function correctly. Read more about [other configuration files](#other-configuration-files) below. |
| `replyByEmail` | `false` | Whether the reply-by-email link is enabled after post. The `author.email` parameter in `config/_default/languages.en.toml` must be set. |
| `forgejoDefaultServer` | _Not set_ | The default `server` parameter for the `forgejo` shortcode. |
| `giteaDefaultServer` | _Not set_ | The default `server` parameter for the `gitea` shortcode. |
| `mainSections` | _Not set_ | The sections that should be displayed in the recent articles list. If not provided the section with the greatest number of articles is used. |

View file

@ -81,6 +81,17 @@
<div class="article-content max-w-prose mb-20">
{{ .Content }}
{{ $defaultReplyByEmail := .Site.Params.replyByEmail }}
{{ $replyByEmail := default $defaultReplyByEmail .Params.replyByEmail }}
{{ if $replyByEmail }}
<strong class="block mt-8">
<a target="_blank"
class="m-1 rounded bg-neutral-300 p-1.5 text-neutral-700 hover:bg-primary-500 hover:text-neutral dark:bg-neutral-700 dark:text-neutral-300 dark:hover:bg-primary-400 dark:hover:text-neutral-800"
href="mailto:{{ .Site.Author.email }}?subject={{ replace (printf "Reply to %s" .Title) "\"" "'" }}">
Reply by Email
</a>
</strong>
{{ end }}
</div>
{{ if (.Params.showAuthorBottom | default ( .Site.Params.article.showAuthorBottom | default false)) }}