Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
May 21, 2020 12:42 pm GMT

GFTW Hackathon: Need some inspiration? - Hugo Web Monetization

Hi, I'm Sabine, a software engineer at Coil. Lately, I have been working on some Web Monetization demos and I also participated in the DeFi Hackathon at San Francisco Blockchain Week last year, where my team's project won one of Xpring's prizes:

I thought I should share these little hacks with you to serve as inspiration for this epic hackathon. This will be a mini-series, so stay tuned for more!

Hugo + Web Monetization: The hackathon

Hugo is a static webpage generator that allows people with some coding skills to set up a beautiful webpage in just a few minutes by writing all of its content in markdown. If you want to do any changes apart from adding pages and post, though, it becomes complicated and you have to dig into the theme's code.

For the hackathon project, we tweaked an existing Hugo theme called Newsroom to allow for simple Web Monetization via the Hugo config.toml file and exclusive content using a div tag. Here is the devpost submission.

I must admit, it wasn't the greatest hack but it made me want to continue to work on it.

Hugo + Web Monetization: The Hugo theme component

A tweaked Hugo theme does not help anybody who wants to use a different theme, so I looked into avenues to get Web Monetization and exclusive content included into every webpage more easily. The fact that Web Monetization is proposed for incubation in the Web Platform Incubator Community Group (WICG) was not enough for the Hugo community to add it to their core - understandable. They pointed me towards theme components, which ended up being my solution:

GitHub logo sabinebertram / hugo-webmonetization-component

Hugo theme component that enables web monetization and exclusive content

Hugo Web Monetization Component

Note: This is not a standalone theme but a theme component that enables web monetization on your entire hugo website.

Web monetization is a standard. It is a JavaScript browser API which allows the creation of a payment stream from the reader to the content creator using the Interledger Protocol. The user needs a browser extension like Coil or Minute, or they are ahead of their time and use the Puma Browser. These will check the website for the existence of a meta tag called "monetization" which includes the payment pointer. You, the content and website creator, need such a a payment pointer.

This component adds a partial including the "monetization" meta tag and the payment pointer of the creator.

How to add the component to your site

Add the component as second theme to your hugo site:

git submodule add [email protected]:sabinebertram/hugo-webmonetization-component.git

A Hugo theme component is installed together with the actual theme, adding extra functionality but has no styling capabilities. It is not a stand-alone theme.

The Hugo - Web Monetization theme component allows for multiple payment pointers, one per page, such that collaborators do not have to worry about splitting payments later. Exclusive content is wrapped in {{% exclusive %}} and {{% /exclusive %}}. Additionally, the lock and unlock messages are freely customizable.

Let me know in the comments if you have ideas of what else I could add to it!


Original Link: https://dev.to/coil/gftw-hackathon-need-some-inspiration-hugo-web-monetization-3k7g

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To