You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Maxim Lebedev 7ceca4ca46
🚚 Moved modules from GitLab to Gitea
3 months ago
..
assets Added WebMonetization module 2 years ago
layouts 🔍 Ignore 404 page 2 years ago
README.md ✏️ Format WebMonetization docs, fixed typos 2 years ago
config.yaml 🔧 Clean mount paths in WebMonetization module 2 years ago
go.mod 🚚 Moved modules from GitLab to Gitea 3 months ago

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 %}}