-
-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ feat(webmentions): add webmentions support templates #485
base: main
Are you sure you want to change the base?
Changes from all commits
84f3301
cab76ee
b930658
426a50f
3247305
e9cfbdc
f2d13b9
ee88359
30819dd
6c6996b
51f3684
74ca55d
1509eff
4f6b641
a663de6
afbf2aa
2bc1f64
e83cef7
9ee3f7c
79ed74b
f18207b
108dfcd
c903689
e19725b
ba4d3b8
cf59175
89ebc6d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ include_content = true | |
# At which character to truncate the content to. Useful if you have a lot of pages and the index would | ||
# become too big to load on the site. Defaults to not being set. | ||
# truncate_content_length = 100 | ||
# Wether to produce the search index as a javascript file or as a JSON file. | ||
# Whether to produce the search index as a javascript file or as a JSON file. | ||
# Accepted value "elasticlunr_javascript" or "elasticlunr_json". | ||
index_format = "elasticlunr_json" | ||
|
||
|
@@ -372,6 +372,47 @@ service = "goatcounter" | |
# Leave this field empty if you're using the service's default hosting. | ||
self_hosted_url = "https://tabi-stats.osc.garden" | ||
|
||
[extra.webmentions] | ||
enabled = true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we rename to |
||
# Specify the domain registered with webmention.io. | ||
domain = "www.example.com" | ||
|
||
# The HTML ID for the object to fill in with the webmention data. | ||
# Defaults to "webmentions" | ||
# id = "webmentions" | ||
|
||
# data configuration for the webmention.min.js script | ||
# The base URL to use for this page. Defaults to window.location | ||
page_url = "https://www.jrussell.ie/blog/update-and-release/10-update-and-release/" | ||
|
||
# Additional URLs to check, separated by |s | ||
# add_urls | ||
|
||
# The maximum number of words to render in reply mentions. | ||
wordcount = 20 | ||
|
||
# The maximum number of mentions to retrieve. Defaults to 30. | ||
# max_webmentions | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about we make it
(commented out) |
||
|
||
# By default, Webmentions render using the mf2 'url' element, which plays | ||
# nicely with webmention bridges (such as brid.gy and telegraph) | ||
# but allows certain spoofing attacks. If you would like to prevent | ||
# spoofing, set this to a non-empty string (e.g. "true"). | ||
# prevent_spoofing | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This sounds like it should be always |
||
|
||
# What to order the responses by; defaults to 'published'. See | ||
# https://github.com/aaronpk/webmention.io#api | ||
# sort_by | ||
|
||
# The order to sort the responses by; defaults to 'up' (i.e. oldest | ||
# first). See https://github.com/aaronpk/webmention.io#api | ||
# sort_dir | ||
|
||
# If set to a non-empty string (e.g. "true"), will display comment-type responses | ||
# (replies/mentions/etc.) as being part of the reactions | ||
# (favorites/bookmarks/etc.) instead of in a separate comment list. | ||
# comments_are_reactions = "true" | ||
|
||
# giscus support for comments. https://giscus.app | ||
# Setup instructions: https://welpo.github.io/tabi/blog/comments/#setup | ||
[extra.giscus] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
+++ | ||
title = "Sense JavaScript obligatori" | ||
date = 2023-01-06 | ||
updated = 2025-02-15 | ||
updated = 2025-02-21 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's a few files that have only the Can you revert these changes? |
||
description = "JavaScript només s'utilitza quan HTML i CSS no són suficients." | ||
|
||
[taxonomies] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
+++ | ||
title = "Mastering tabi Settings: A Comprehensive Guide" | ||
date = 2023-09-18 | ||
updated = 2025-02-16 | ||
updated = 2025-02-21 | ||
description = "Discover the many ways you can customise your tabi site." | ||
|
||
[taxonomies] | ||
|
@@ -113,7 +113,7 @@ The description is regular Markdown content, set outside the front matter. | |
|
||
#### Listing Recent Posts | ||
|
||
To show posts on your main page, you first need to decide where these posts will be served from: the root path (`/`) or a subdirectory (e.g., `/blog`). | ||
To show posts on your main page, you first need to decide where these posts will be served from: the root path (`/`) or a subdirectory (e.g., `/blog`). | ||
|
||
**Option A: Serve posts from the root path (`/`)** | ||
|
||
|
@@ -789,6 +789,34 @@ 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. | ||
|
||
### Webmentions {#adding-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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd make the references inline links |
||
|
||
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. | ||
|
||
Enable webmentions for your site by adding the following to your `config.toml` file. | ||
|
||
``` | ||
[extra.webmentions] | ||
enable = true | ||
# Specify the domain registered with webmention.io. | ||
domain = "www.example.com" | ||
``` | ||
|
||
Add the shortcut on the page where you want to display the webmentions: | ||
|
||
``` | ||
{{/* webmentions() */}} | ||
``` | ||
|
||
The webmentions section will then be displayed where you added it on the page as follows: | ||
|
||
{{ dual_theme_image(light_src="blog/mastering-tabi-settings/img/webmention_light.webp", dark_src="blog/mastering-tabi-settings/img/webmention_dark.webp" alt="Page footer, showing a 'Site source' link") }} | ||
|
||
[1]: https://www.w3.org/TR/webmention/#abstract-p-1 | ||
[2]: https://webmention.io/ | ||
|
||
### Analytics | ||
|
||
| Page | Section | `config.toml` | Follows Hierarchy | Requires JavaScript | | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
+++ | ||
title = "Custom shortcodes" | ||
date = 2023-02-19 | ||
updated = 2025-02-15 | ||
updated = 2025-02-21 | ||
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] | ||
|
@@ -79,9 +79,9 @@ classDiagram | |
+MakeAssumptions() | ||
} | ||
CognitiveDistortions *-- AllOrNothingThinking | ||
CognitiveDistortions *-- Overgeneralization | ||
CognitiveDistortions*-- Overgeneralization | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can I get my two spaces back? 🤓 |
||
CognitiveDistortions *-- MentalFilter | ||
CognitiveDistortions *-- JumpingToConclusions | ||
CognitiveDistortions*-- JumpingToConclusions | ||
{% end %} | ||
|
||
The Mermaid shortcode supports two parameters: | ||
|
@@ -121,6 +121,7 @@ Useful if you want to use a different image for the light and dark themes: | |
{{ dual_theme_image(light_src="img/paris_day.webp", dark_src="img/paris_night.webp" alt="The Eiffel tower") }} | ||
|
||
#### Usage | ||
|
||
``` | ||
{{/* dual_theme_image(light_src="img/paris_day.webp", dark_src="img/paris_night.webp" alt="The Eiffel tower") */}} | ||
``` | ||
|
@@ -151,7 +152,7 @@ Images with too much brightness or contrast can be jarring against a dark backgr | |
|
||
### Swap image on hover | ||
|
||
Povides an interaction where the image displayed changes as the user hovers over it. Useful for before-after comparisons, for example. | ||
Provides an interaction where the image displayed changes as the user hovers over it. Useful for before-after comparisons, for example. | ||
|
||
{{ image_hover(default_src="img/edited.webp", hovered_src="img/raw.webp", default_alt="Edited picture", hovered_alt="Original shot") }} | ||
|
||
|
@@ -312,19 +313,19 @@ Display lines 3 to 7 (both inclusive) of a local file: | |
|
||
Bring attention to information with these admonition shortcodes. They come in five `type`s: `note`, `tip`, `info`, `warning`, and `danger`. | ||
|
||
{{ admonition(type="note", text="Some **content** with _Markdown_ `syntax`. Check [this `api`](#).") }} | ||
{{ admonition(type="note", text="Some **content** with *Markdown* `syntax`. Check [this `api`](#).") }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why this change? |
||
|
||
{{ admonition(type="tip", text="Some **content** with _Markdown_ `syntax`. Check [this `api`](#).") }} | ||
{{ admonition(type="tip", text="Some **content** with *Markdown* `syntax`. Check [this `api`](#).") }} | ||
|
||
{{ admonition(type="info", text="Some **content** with _Markdown_ `syntax`. Check [this `api`](#).") }} | ||
{{ admonition(type="info", text="Some **content** with *Markdown* `syntax`. Check [this `api`](#).") }} | ||
|
||
{{ admonition(type="warning", text="Some **content** with _Markdown_ `syntax`. Check [this `api`](#).") }} | ||
{{ admonition(type="warning", text="Some **content** with *Markdown* `syntax`. Check [this `api`](#).") }} | ||
|
||
{{ admonition(type="danger", text="Some **content** with _Markdown_ `syntax`. Check [this `api`](#).") }} | ||
{{ admonition(type="danger", text="Some **content** with *Markdown* `syntax`. Check [this `api`](#).") }} | ||
|
||
You can change the `title` and `icon` of the admonition. Both parameters take a string and default to the type of admonition. `icon` can be any of the available admonition types. | ||
|
||
{{ admonition(type="note", icon="tip", title="Custom title and icon", text="Some **content** with _Markdown_ `syntax`. Check [this `api`](#).") }} | ||
{{ admonition(type="note", icon="tip", title="Custom title and icon", text="Some **content** with *Markdown* `syntax`. Check [this `api`](#).") }} | ||
|
||
#### Usage | ||
|
||
|
@@ -352,12 +353,12 @@ Both methods support the same parameters (`type`, `icon`, and `title`), with the | |
|
||
This shortcode allows you to display both the translated and original text for a quote. The quotation marks will be added automatically: | ||
|
||
{{ multilingual_quote(original="Qué sosiego, ir por la vida en silencio, saludando sólo a los amigos.", translated="What tranquility, to go through life in silence, greeting only friends.", author="Francisco Umbral") }} | ||
{{ multilingual_quote(original="Qué sosiego, ir por la vida en silencio, saludando sólo a los amigos.", translated="What tranquillity, to go through life in silence, greeting only friends.", author="Francisco Umbral") }} | ||
|
||
#### Usage | ||
|
||
``` | ||
{{/* multilingual_quote(original="Qué sosiego, ir por la vida en silencio, saludando sólo a los amigos.", translated="What tranquility, to go through life in silence, greeting only friends.", author="Francisco Umbral") */}} | ||
{{/* multilingual_quote(original="Qué sosiego, ir por la vida en silencio, saludando sólo a los amigos.", translated="What tranquillity, to go through life in silence, greeting only friends.", author="Francisco Umbral") */}} | ||
``` | ||
|
||
### References with hanging indent | ||
|
@@ -414,7 +415,7 @@ Use this shortcode if you want to have a wider table, paragraph, code block… O | |
|
||
| Title | Year | Director | Cinematographer | Genre | IMDb | Duration | | ||
|-------------------|-------|----------------------|-----------------------|---------------|-------|--------------| | ||
| Beoning | 2018 | Lee Chang-dong | Hong Kyung-pyo | Drama/Mystery | 7.5 | 148 min | | ||
| Burning | 2018 | Lee Chang-dong | Hong Kyung-pyo | Drama/Mystery | 7.5 | 148 min | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd like to keep the original name :) |
||
| The Master | 2012 | Paul Thomas Anderson | Mihai Mălaimare Jr. | Drama/History | 7.1 | 137 min | | ||
| The Tree of Life | 2011 | Terrence Malick | Emmanuel Lubezki | Drama | 6.8 | 139 min | | ||
|
||
|
@@ -439,10 +440,12 @@ Force the text direction of a content block. Overrides both the global `force_co | |
Accepts the parameter `direction`: the desired text direction. This can be either "ltr" (left-to-right) or "rtl" (right-to-left). Defaults to "ltr". | ||
|
||
{% force_text_direction(direction="rtl") %} | ||
|
||
```python | ||
def مرحبا_بالعالم(): | ||
print("مرحبا بالعالم!") | ||
``` | ||
|
||
{% end %} | ||
|
||
#### Usage | ||
|
@@ -459,3 +462,37 @@ def مرحبا_بالعالم(): | |
|
||
{%/* end */%} | ||
```` | ||
|
||
## Displaying webmentions for your posts | ||
|
||
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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of duplicating the docs, I'd make this more focused on the shortcode itself, and add an internal link to the other section for more info |
||
|
||
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, add the following to your `config.toml` file: | ||
|
||
```toml | ||
[extra.webmentions] | ||
enabled = true | ||
# Specify the domain registered with webmention.io. | ||
domain = "www.example.com" | ||
``` | ||
|
||
Add the shortcut on the page where you want to display the webmentions: | ||
|
||
``` | ||
{{/* webmentions() */}} | ||
``` | ||
|
||
The webmentions section will then be displayed where you added it on the page as follows: | ||
|
||
{{ dual_theme_image(light_src="blog/mastering-tabi-settings/img/webmention_light.webp", dark_src="blog/mastering-tabi-settings/img/webmention_dark.webp" alt="Page footer, showing a 'Site source' link") }} | ||
|
||
The following is a live example based on the specific page_url configured in the template config.toml. | ||
|
||
{{ webmentions() }} | ||
|
||
[1]: https://www.w3.org/TR/webmention/#abstract-p-1 | ||
[2]: https://webmention.io/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of these settings should be unset by default (e.g.
domain =""
), and the feature should be disabled