52 lines
1.5 KiB
Markdown
52 lines
1.5 KiB
Markdown
# Publish Markdown articles to Nostr
|
|
|
|
I'm currently using [this bash script][1] to publish [long-form content][2]
|
|
from local Markdown files to Nostr relays.
|
|
|
|
It requires all of `yq`, `jq`, and `nak` to be installed.
|
|
|
|
## Usage
|
|
|
|
Create a signed Nostr event and print it to the console:
|
|
|
|
markdown_to_nostr.sh article-filename.md
|
|
|
|
Create a Nostr event and publish it to one or more relays:
|
|
|
|
markdown_to_nostr.sh article-filename.md ws://localhost:7777 wss://nostr.kosmos.org
|
|
|
|
## Markdown format
|
|
|
|
You can specify your metadata as YAML in a Front Matter header. Here's an
|
|
example file:
|
|
|
|
```md
|
|
---
|
|
title: "Good Morning"
|
|
summary: "It's a beautiful day"
|
|
image: https://example.com/i/beautiful-day.jpg
|
|
date: 2025-04-24T15:00:00Z
|
|
tags: gm, poetry
|
|
published: false
|
|
---
|
|
|
|
In the blue sky just a few specks of gray
|
|
In the evening of a beautiful day
|
|
Though last night it rained and more rain on the way
|
|
And that more rain is needed 'twould be fair to say.
|
|
|
|
— Francis Duggan
|
|
```
|
|
|
|
The metadata keys are mostly self-explanatory. Note:
|
|
|
|
* All keys except for `title` are optional
|
|
* `date`, if present, will be set as the `published_at` date.
|
|
* If `published` is set to `true`, it will publish a kind 30023 event,
|
|
otherwise a kind 30024 (draft)
|
|
* The `d` tag (widely used as URL slug for the article) will be the filename
|
|
without the `.md` extension
|
|
|
|
[1]: https://gitea.kosmos.org/raucao/gists/src/branch/master/1/markdown_to_nostr.sh
|
|
[2]: https://github.com/nostr-protocol/nips/blob/master/23.md
|