Merge pull request #2 from jerusdp/webmentions

Webmentions
This commit is contained in:
gortavoher 2025-02-12 14:12:16 +00:00 committed by GitHub
commit 79ed74b48a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 20 additions and 21 deletions

View file

@ -328,7 +328,6 @@ allowed_domains = [
{ directive = "script-src", domains = ["'self'"] }, { directive = "script-src", domains = ["'self'"] },
{ directive = "style-src", domains = ["'self'"] }, { directive = "style-src", domains = ["'self'"] },
{ directive = "frame-src", domains = ["player.vimeo.com", "https://www.youtube-nocookie.com"] }, { directive = "frame-src", domains = ["player.vimeo.com", "https://www.youtube-nocookie.com"] },
# { directive = "connect-src", domains = [ "https://webmention.io"] },
] ]
# Enable the CSP directives configured (or default). # Enable the CSP directives configured (or default).
@ -365,9 +364,9 @@ service = "goatcounter"
self_hosted_url = "https://tabi-stats.osc.garden" self_hosted_url = "https://tabi-stats.osc.garden"
[extra.webmentions] [extra.webmentions]
# enable = true enabled = true
# Specify the domain registered with webmention.io. # Specify the domain registered with webmention.io.
# domain = "www.example.com" domain = "www.example.com"
# The HTML ID for the object to fill in with the webmention data. # The HTML ID for the object to fill in with the webmention data.
# Defaults to "webmentions" # Defaults to "webmentions"
@ -381,7 +380,7 @@ page_url = "https://beesbuzz.biz/code/439-Falsehoods-programmers-believe-about-e
# add_urls # add_urls
# The maximum number of words to render in reply mentions. # The maximum number of words to render in reply mentions.
# wordcount = 20 wordcount = 20
# The maximum number of mentions to retrieve. Defaults to 30. # The maximum number of mentions to retrieve. Defaults to 30.
# max_webmentions # max_webmentions

View file

@ -1,7 +1,7 @@
+++ +++
title = "Mastering tabi Settings: A Comprehensive Guide" title = "Mastering tabi Settings: A Comprehensive Guide"
date = 2023-09-18 date = 2023-09-18
updated = 2025-02-11 updated = 2025-02-12
description = "Discover the many ways you can customise your tabi site." description = "Discover the many ways you can customise your tabi site."
[taxonomies] [taxonomies]
@ -767,22 +767,15 @@ If you have enabled a system globally, but want to disable it on a specific page
Read [the docs](@/blog/comments/index.md) for more information on the available systems and their setup. Read [the docs](@/blog/comments/index.md) for more information on the available systems and their setup.
## Webmentions ### Webmentions
As described by the recommended W3C standard [Webmention][1] is a simple way to notify any URL when you mention it on your site. From the receiver's perspective, it's a way to request notifications when other sites mention it. As described by the recommended W3C standard [Webmention][1] is a simple way to notify any URL when you mention it on your site. From the receiver's perspective, it's a way to request notifications when other sites mention it.
For static sites [webmention.io][2] hosts a webmention endpoint that can be used to receive webmentions. This feature fetches the webmentions stored at webmention.io and displays them for a page. You will need to have setup an account for your website at webmention.io. When you enable the webmention feature it will advertise your webmention.io endpoint and display the webmentions for any post using the webmention shortcut. For static sites [webmention.io][2] hosts a webmention endpoint that can be used to receive webmentions. This feature fetches the webmentions stored at webmention.io and displays them for a page. You will need to have setup an account for your website at webmention.io. When you enable the webmention feature it will advertise your webmention.io endpoint and display the webmentions for any post using the webmention shortcut.
### Configuration and Usage Enable webmentions for your site by adding the following to your `config.toml` file.
Enable webmentions for your site by adding the following to your `config.toml` file. A directive for CSP is required to allow the webmention.io endpoint to be used.
```toml
[extra]
allowed_domains = [
{ directive = "connect-src", domains = [ "https://webmention.io"] },
]
```
[extra.webmentions] [extra.webmentions]
enable = true enable = true
# Specify the domain registered with webmention.io. # Specify the domain registered with webmention.io.

View file

@ -1,7 +1,7 @@
+++ +++
title = "Custom shortcodes" title = "Custom shortcodes"
date = 2023-02-19 date = 2023-02-19
updated = 2025-02-11 updated = 2025-02-12
description = "This theme includes some useful custom shortcodes that you can use to enhance your posts. Whether you want to display images that adapt to light and dark themes, or format a professional-looking reference section, these custom shortcodes have got you covered." description = "This theme includes some useful custom shortcodes that you can use to enhance your posts. Whether you want to display images that adapt to light and dark themes, or format a professional-looking reference section, these custom shortcodes have got you covered."
[taxonomies] [taxonomies]
@ -455,7 +455,7 @@ Enable webmentions for your site, add the following to your `config.toml` file:
```toml ```toml
[extra.webmentions] [extra.webmentions]
enable = true enabled = true
# Specify the domain registered with webmention.io. # Specify the domain registered with webmention.io.
domain = "www.example.com" domain = "www.example.com"
``` ```
@ -466,5 +466,7 @@ Add the shortcut on the page where you want to display the webmentions:
{{/* webmentions() */}} {{/* webmentions() */}}
``` ```
{{ webmentions() }}
[1]: https://www.w3.org/TR/webmention/#abstract-p-1 [1]: https://www.w3.org/TR/webmention/#abstract-p-1
[2]: https://webmention.io/ [2]: https://webmention.io/

View file

@ -54,6 +54,12 @@ content="default-src 'self'
{%- set script_src = script_src ~ " " ~ " cdn.jsdelivr.net" -%} {%- set script_src = script_src ~ " " ~ " cdn.jsdelivr.net" -%}
{%- endif -%} {%- endif -%}
{#- Check if a webmention system is enabled to allow the necessary domains and directives -#}
{%- set webmention_enabled = config.extra.webmentions.enabled -%}
{%- if webmention_enabled -%}
{%- set connect_src = connect_src ~ " webmention.io" -%}
{%- endif -%}
{#- Append WebSocket for Zola serve mode -#} {#- Append WebSocket for Zola serve mode -#}
{%- if config.mode == "serve" -%} {%- if config.mode == "serve" -%}
{%- set connect_src = connect_src ~ " ws:" -%} {%- set connect_src = connect_src ~ " ws:" -%}

View file

@ -154,7 +154,7 @@
{%- endif -%} {%- endif -%}
{# Webmentions #} {# Webmentions #}
{%- if config.extra.webmentions.enable -%} {%- if config.extra.webmentions.enabled -%}
{%- include "partials/webmentions.html" -%} {%- include "partials/webmentions.html" -%}
{%- endif -%} {%- endif -%}

View file

@ -285,7 +285,6 @@ allowed_domains = [
{ directive = "script-src", domains = ["'self'"] }, { directive = "script-src", domains = ["'self'"] },
{ directive = "style-src", domains = ["'self'"] }, { directive = "style-src", domains = ["'self'"] },
{ directive = "frame-src", domains = ["player.vimeo.com", "https://www.youtube-nocookie.com"] }, { directive = "frame-src", domains = ["player.vimeo.com", "https://www.youtube-nocookie.com"] },
# { directive = "connect-src", domains = [ "https://webmention.io"] },
] ]
# Enable the CSP directives configured (or default). # Enable the CSP directives configured (or default).
@ -322,7 +321,7 @@ custom_subset = true
# self_hosted_url = "" # self_hosted_url = ""
[extra.webmentions] [extra.webmentions]
# enable = true # enabled = true
# Specify the domain registered with webmention.io. # Specify the domain registered with webmention.io.
# domain = "www.example.com" # domain = "www.example.com"
@ -332,7 +331,7 @@ custom_subset = true
# data configuration for the webmention.min.js script # data configuration for the webmention.min.js script
# The base URL to use for this page. Defaults to window.location # The base URL to use for this page. Defaults to window.location
# page_url = "https://beesbuzz.biz/code/439-Falsehoods-programmers-believe-about-email" # page_url =
# Additional URLs to check, separated by |s # Additional URLs to check, separated by |s
# add_urls # add_urls