hugo/webmonetization
Maxim Lebedev 7ceca4ca46
🚚 Moved modules from GitLab to Gitea
2022-03-27 19:33:04 +05:00
..
assets Added WebMonetization module 2020-12-06 06:48:59 +05:00
layouts 🔍 Ignore 404 page 2020-12-07 07:35:08 +05:00
README.md ✏️ Format WebMonetization docs, fixed typos 2020-12-06 17:34:43 +05:00
config.yaml 🔧 Clean mount paths in WebMonetization module 2020-12-25 21:08:48 +05:00
go.mod 🚚 Moved modules from GitLab to Gitea 2022-03-27 19:33:04 +05:00

README.md

WebMonetization

Simple WebMonetization support for Hugo static generated site.

Install

Config

Import module in your site
configuration:

imports:
- path: gitlab.com/toby3d/hugo/webmonetization

Template

And inject monetization partial in your <head> (better in the _default/baseof.html layout):

<head>
  ...
  {{ partial "monetization" . }}
</head>

The template contains logic of meta-tag displaying and preloading of non-blocking script for
blocks manipulation.

Usage

Global

Add monetization param in your site configuration for monetize all pages by default:

baseUrl: https://example.com/
params:
  monetization: "$wallet.example.com/alice"

Local

You can overwrite monetization tag or, if the global parameter is not set, enable monetization
only on specific pages by same param in front matter:

---
title: My monetized post
monetization: "$wallet.example.com/alice"
---

Use the false value to force disable the current page monetization (if the site is monetized
globally):

---
title: My demonetized post
monetization: false
---

Markup

Just wrap paid front matter content into {{% monetization %}}...{{% /monetization %}} tags:

...
{{% monetization %}}
## Thanks for your support!
Here is exclusive content for you.
{{% /monetization %}}

All content between these tags will be completely hidden until the successful monetization.

Advanced markup

Use state parameter to customize the display of monetized content more flexibly:

  • Use the named state parameter for readability: {{% monetization state="start" %}}
  • The parameter name can be omitted for short: {{% monetization "start" %}}
  • If no parameter is specified, the "start" state will be used by default: {{% monetization %}}

stop

Use this state to explain what content may be available after activate an add-on or install a
compatible browser. This content will be completely hidden from the moment of monetization
initialization. This event can also be useful for displaying promotional sections until the page
is monetized.

{{% monetization state="stop" %}}
Please, install [Coil](https://coil.com/learn-more) browser extension or use
[Puma Browser](https://pumabrowser.com/) to see paid content here. 
{{% /monetization %}}

progress

This state describes the monetization initialization process and attempts to send the first coins.
Use this to describe what happens to visitors with slow connections.

{{% monetization state="progress" %}}
Loading paid content for you...
{{% /monetization %}}

start

This state is activated as soon as the first coins are successfully sent. This is the standard
state for the monetized block if no parameter was specified.

{{% monetization state="start" %}}
## Thanks for your support!
Here is exclusive content for you.
{{% /monetization %}}