Skip to content

dannypsnl/webmentions_db

Repository files navigation

WebmentionsDb

A local cache management system for webmentions, it daily

  • fetch new mentions from https://webmention.io/
  • produce mentions tree for each mentioned target (a URL that usually is your site post).

This project only care about work with forester, because that's what I use; it's still possible to support others site, but you will need to modify Gen.generate function, I'm welcome any contributions that generalized the interface, so more people can use this project without pain.

Setup

git clone https://github.com/dannypsnl/webmentions_db.git
# run database up, this need ./db-data/ directory
docker compose up -d

The environment variables you need are

export DOMAIN=<your site url without scheme>
export TOKEN=<webmention.io token>

Then run mix run script/init.exs to setup your local database. Since this system can daily update, so it's up to you to run it at background, or use scripts below manually

mix run script/update.exs
mix run script/generate.exs

Usage

I use this repository as a submodule of my blog, and add the generated webmentions_db/trees/ into my forester configuration, structure as below

site/
  webmentions_db/
    trees/
      webmention-macros.tree
      *.tree
  site-trees/
    *.tree

generate JSON instead

If you want to generate JSON file rather than .tree, then modify the config/config.exs

config :webmentions_db,
  # ...
  generate_kind: :json,
  output_dir: "output",
  # ...
  extension: "json"

Concept

  1. A mention is a link that talk about a (target) URL of your site.
  2. A mentioned target is a URL under your site.

About

fetch and cache https://webmention.io, produces forester tree via mentions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published