DEV Community

Cover image for A Jekyll plugin for Web Monetization
Phil Nash
Phil Nash

Posted on • Edited on

A Jekyll plugin for Web Monetization

What I built

Inspired by Sabine's post on her Hugo theme component and Daniel's Eleventy plugin I thought I would try to bring Web Monetization to the world of Jekyll.

I create the jekyll-web_monetization gem which aims to make it easy to add payment pointers to Jekyll sites. You can set a site-wide payment pointer, which is great if it is your own site. Or, if you have multiple authors, you can set per-post payment pointers in the the page's YAML front matter.

If your site or page has multiple owners, you can also set multiple payment pointers, site wide or per page. Check the documentation for how to achieve probabilistic revenue sharing with this gem.

Submission Category:

Foundational Technology

Demo

I had previously added Web Monetization by hand to my own Jekyll powered site, but as a demo I have replaced the hand rolled solution with my jekyll-web_monetization gem.

Link to Code

You can see all the code and documentation here:

GitHub logo philnash / jekyll-web_monetization

A Jekyll plugin to add Web Monetization API payment pointers to your site

Jekyll::WebMonetization

A Jekyll plugin to add Web Monetization API payment pointers to your site.

Gem Version Build status Maintainability Inline docs

Web Monetization

A JavaScript browser API which allows the creation of a payment stream from the user agent to the website.

Find out more about Web Monetization.

Payment pointer

To use this plugin and receive payments from Web Monetization you will need a payment pointer. A payment pointer is an address at which you can receive streaming payments from the Web Monetization API. You can set up a payment pointer by creating a digital wallet with one of the providers listed on the Web Monetization API site.

You can read more about payment pointers and receiving money from Web Monetization in the relevant documentation.

Installation

Add the gem to the :jekyll_plugins group in your Jekyll site's Gemfile:

group :jekyll_plugins do
  gem 'jekyll-web_monetization'
end
Enter fullscreen mode Exit fullscreen mode

Execute:

  $ bundle install
Enter fullscreen mode Exit fullscreen mode

Then in your site's _config.yml add the…

How I built it

This is not the first Jekyll plugin I have built, but this is the first time I created a custom liquid tag to be used in a site. There was not a lot of code needed, in fact the hardest part was digging into the config that is passed to a liquid tag as it is rendered in order to extract the information so it could be added to the page.

Top comments (1)

Collapse
 
bernardbaker profile image
Bernard Baker

Great idea, I'm sure people will use it.