diff options
| author | Paul Buetow <paul@buetow.org> | 2023-07-15 14:04:54 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2023-07-15 14:04:54 +0300 |
| commit | 49c1436c37a015d8e47cdc1c29f120cb42d0eb17 (patch) | |
| tree | 90f5c8de417584f4c90d17437f78e36091808816 | |
| parent | 816f3bed0e730b0275201c43d1baabe821e66e23 (diff) | |
Mastadon verification support
| -rw-r--r-- | README.md | 20 | ||||
| -rwxr-xr-x | gemtexter | 1 | ||||
| -rw-r--r-- | gemtexter-paul.buetow.org.conf | 1 | ||||
| -rw-r--r-- | lib/html.source.sh | 17 |
4 files changed, 38 insertions, 1 deletions
@@ -202,6 +202,26 @@ You will find the `./extras/html/header.html.part` and `./extras/html/footer.htm `gemtexter` will never touch the `$BASE_CONTENT_DIR/html/.domains`, as this is a required file for a Codeberg page. Furthermore, the `robots.txt` file won't be overridden as well. +### HTML Mastadon verification + +https://joinmastodon.org/verification explains how it works on Mastadon. So we have to hyperlink to the Mastadon profile to be verified and also include a `rel='me'` into the tag. In order to do that add this to the `gemtexter.conf` (replace the URI to your Mastadon profile accordingly): + +``` +declare -xr MASTADON_URI='https://fosstodon.org/@snonux' +``` + +and add the following into your `index.gmi`: + +``` +=> https://fosstodon.org/@snonux Me at Mastaton +``` + +The resulting line in the HTML output will be something as follows: + +``` +<a href="https://fosstodon.org/@snonux" rel='me'>Me at mastadon</a> +``` + ### Special Markdown configuration for GitHub pages `gemtexter` will never touch the `$BASE_CONTENT_DIR/md/_config.yml` file (if it exists). That's a particular configuration file for GitHub Pages. `gemtexter` also will never modify the file `$BASE_CONTENT_DIR/md/CNAME`, as this is also a file required by GitHub pages for using custom domains. @@ -29,6 +29,7 @@ test -z "$LOG_VERBOSE" && LOG_VERBOSE='' test -z "$PRE_GENERATE_HOOK" && PRE_GENERATE_HOOK='' test -z "$POST_PUBLISH_HOOK" && POST_PUBLISH_HOOK='' test -z "$HTML_VARIANT" && HTML_VARIANT='' +test -z "$MASTADON_URI" && MASTADON_URI='' set -euf -o pipefail diff --git a/gemtexter-paul.buetow.org.conf b/gemtexter-paul.buetow.org.conf index 0949de1..d1c4f86 100644 --- a/gemtexter-paul.buetow.org.conf +++ b/gemtexter-paul.buetow.org.conf @@ -3,6 +3,7 @@ declare -xr DOMAIN=paul.buetow.org declare -xr SUBTITLE="Paul Buetow's contact information" declare -xr AUTHOR='Paul Buetow' declare -xr EMAIL='contact@mx.buetow.org' +declare -xr MASTADON_URI='https://fosstodon.org/@snonux' declare -xr IMAGE_PATTERN='\.(jpg|png|gif)$' declare -xr ATOM_MAX_ENTRIES=42 declare -xr CONTENT_BASE_DIR=../paul.buetow.org-content diff --git a/lib/html.source.sh b/lib/html.source.sh index b60ac75..371866a 100644 --- a/lib/html.source.sh +++ b/lib/html.source.sh @@ -71,7 +71,12 @@ html::make_link () { descr="$link" fi - echo "<a class='textlink' href='$(html::encode "$link")'>$descr</a><br />" + local mastadon_verify='' + if [[ "$link" = "$MASTADON_URI" ]]; then + mastadon_verify=" rel='me'" + fi + + echo "<a class='textlink' href='$(html::encode "$link")'$mastadon_verify>$descr</a><br />" } html::process_inline () { @@ -192,6 +197,8 @@ $line" # Test default HTML variant. html::test::default () { + MASTADON_URI='' + local line='Hello world! This is a paragraph.' assert::equals "$(html::make_paragraph "$line")" '<p>Hello world! This is a paragraph.</p>' @@ -227,6 +234,13 @@ html::test::default () { assert::equals "$(generate::make_link html "$line")" \ "<a class='textlink' href='http://example.org'>Description of the link</a><br />" + # Test Mastadon verification. + MASTADON_URI='https://fosstodon.org/@snonux' + line='=> https://fosstodon.org/@snonux Me at Mastadon' + assert::equals "$(generate::make_link html "$line")" \ + "<a class='textlink' href='https://fosstodon.org/@snonux' rel='me'>Me at Mastadon</a><br />" + MASTADON_URI='' + line='=> http://example.org/image.png' assert::equals "$(generate::make_link html "$line")" \ "<a href='http://example.org/image.png'><img src='http://example.org/image.png' /></a><br />" @@ -235,6 +249,7 @@ html::test::default () { assert::equals "$(generate::make_link html "$line")" \ "<a href='http://example.org/image.png'><img alt='Image description' title='Image description' src='http://example.org/image.png' /></a><br />" + local input_block='``` this is |
