Webmention
This plugin provides a Webmention endpoint for Craft CMS and allows for sending Webmentions to other sites.
Requirements
This plugin requires Craft CMS 5.6.10 or later.
Installation
You can install this plugin from Craft’s in-app Plugin Store.
Go to the Plugin Store in your project’s Control Panel and search for “Webmention”, then click on the “Install” button in the sidebar.
Receiving Webmentions: The Webmention endpoint
In order to receive Webmentions, the Webmention endpoint of your site needs to be discoverable by the server sending the Webmention. So you will need to add the following line in the <head>
section of your main layout template:
<link rel="webmention" href="{{ craft.webmention.endpointUrl }}" />
And/or you can set an HTTP Link header by adding this line to your main layout template:
{% header "Link: <" ~ craft.webmention.endpointUrl ~ ">; rel=\"webmention\"" %}
The plugin comes with a „human-friendly“ endpoint that will present a form with input fields for source
and target
to users visiting your site’s endoint route. The Twig template for the Webmention endpoint will extend your standard template. Run the following CLI command to copy an example webmention endpoint template into your project’s templates/
directory:
php craft webmention/example-template
You can then adjust the template to your needs.
Displaying Webmentions
To output all Webmentions for the current request URL, you can use the following helper in your templates:
{{ craft.webmention.showWebmentions() }}
If you want full control over the HTML output for Webmentions, you can fetch all Webmentions for the current URL:
{% for webmention in craft.webmention.getWebmentions() %}
<li>
<a href="{{ webmention.source }}">{{ webmention.authorName }}</a>:
{{ webmention.text }}
</li>
{% endfor %}
To fetch all Webmentions for an element, you can call getWebmentions()
on the element:
{% for webmention in entry.getWebmentions() %}
…
{% endfor %}
And if you want to fetch only Webmentions of a certain type, like comments, likes, or reposts, you can call getWebmentionsByType()
on the element:
{% for webmention in element.getWebmentionsByType('like') %}
…
{% endfor %}
Display a Webmention form for the current URL
You can output a form in your entry template that lets people directly send you the URL of a response. For this, use this helper:
{{ craft.webmention.webmentionForm() }}
Sending Webmentions
Once installed, your Craft site will automatically send Webmentions to other sites. On every save of a published entry, the plugin scans the complete entry for any occurrences of URLs and then sends Webmentions to the corresponding Webmention endpoints.
For more information on how to install and configure the plugin, check out the GitHub repository.
To install this plugin, copy the command above to your terminal.
This plugin doesn't have any reviews.