/django-wm

Automatic Webmention functionality for Django models

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

django-wm

Tests pypi package

django-wm lets you add Webmention functionality to your Django project with minimal setup.

Upgrading

Please check the changelog before upgrading.

Major versions introduce breaking changes which may require code changes in your application. Please check the upgrade guide for full instructions on how to handle these.

Minor versions may require a database migration for new features - this will be noted in the changelog and the wiki release page when necessary.

Getting started

Setup instructions.

Code for an example project.

All done? You can use the testing tool to make sure it works.

Features

  • Endpoints:

    • /webmention: Receives incoming Webmentions from other sites.
    • /webmention/get: Used to retrieve Webmentions for a page on your site.
      e.g. /webmention/get?url=/my-article will return any received Webmentions that target /my-article on your site.
      // /webmention/get?url=/my-article
      {
        "target_url": "https://my-site.org/my-article",
        "mentions": [
          {
            "hcard": {
              "name": "Jane Bloggs",
              "avatar": "https://gravatar.com/janebloggs",
              "homepage": "https://jane-bloggs-example.org"
            },
            "quote": null,
            "source_url": "https://jane-bloggs-example.org/some-article",
            "published": "2020-01-17T21:45:24.542Z",
            "type": "webmention"
          }
        ]
      }
  • WebmentionHeadMiddleware adds your /webmention endpoint to the headers of your pages so that it can be discovered by other sites.

  • {% webmentions_endpoint %} template tag to include your /webmention endpoint to your Django templates HTML element.

  • MentionableMixin enables automatic submission of Webmentions to other sites when you mention them in your content.