Skip to content

straumer/huno

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Huno

Huno (HUgo NOstr) gives you access to your Nostr events when generating a static site with Hugo.

Running huno fetches the events specified in hugo.toml and lays them out with additional helpful data in the data/nostr directory of your Hugo project. This makes them accessible in content adapters and templates. Subsequent runs of huno syncs new events and updates or deletes events as needed.

Install

git clone https://github.com/straumer/huno.git
cargo install --path huno

Quickstart

In the root of your Hugo project, write to hugo.toml:

[nostr]
  author = "npub1wukm87rrl4jh680jr0h0ceuk27z2dpa0y9swl4dvpa8g2696dz6qauayfa"

Replace npub... with your own npub. Then run huno. This generates JSON files in data/nostr organized like this:

state.json
events
	<id1>
  	event.json
  	meta.json
	<id2>
  <id3>
	...

Now the events can be accessed in content adapters and templates via the data object as hugo.Data.nostr.

Use the hugo-nostr module to easily include that event data as content in your content directory via prepackaged partials.

Relays

If no relays are specified, huno discovers where to get the events based on a set of default relays. In order to only get events from specific relays, they can be specified as such:

[nostr]
  author = "npub1wukm87rrl4jh680jr0h0ceuk27z2dpa0y9swl4dvpa8g2696dz6qauayfa"
  relays = ["wss://myrelay.xyz", ...]

Discovery relays can also be specified to use them instead of the defaults:

[nostr]
  author = "npub1wukm87rrl4jh680jr0h0ceuk27z2dpa0y9swl4dvpa8g2696dz6qauayfa"
  discovery_relays = ["wss://mydiscoveryrelay.xyz", ...]

Filter

Instead of only specifying a single author, a filter can be used instead (see NIP-01 for details):

[nostr]
  [nostr.filter]
    authors = [
      "npub1wukm87rrl4jh680jr0h0ceuk27z2dpa0y9swl4dvpa8g2696dz6qauayfa",
      "npub1wukm87rrl4jh680jr0h0ceuk27z2dpa0y9swl4dvpa8g2696dz6qauayfb"
    ]
    kinds = [0, 1, 5]

When author is used, the default is kinds = [0, 1, 5, 30023].

The above configuration has been tested to work, but other ones may or may not work for now.

Todo

  • nip05 support in author field in hugo.conf
  • introduce concurrency in file writing and possibly more

About

A utility to integrate Nostr events with Hugo to statically generate a website from them.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages