🎈 Blogo
Blogo is a light and easy blogging engine. No complicated extras, just a straightforward blog.
Now, here's the twist: Blogo can also publish your posts to Nostr for backing them up and getting even more reach. Lift your ideas higher!
- Easy to use:Just put Markdown files in a folder and Blogo will take care of the rest.
- Fast: Blogo is written in Golang and uses Redis as the backend db.
- Light: Blogo is light on resources, and light on your eyes:
- No JS, no tracking, no cookies.
- No cluttered UI, focus on reading.
- No database, just Redis.
- ~10MB Docker image.
- Markdown: Write your posts in Markdown.
- Github Flavored Markdown is supported.
- Syntax Highlighting using chroma
- YAML Metadata for posts info.
- Feeds: RSS, Atom and JSON feeds!
- About page: Easily create an About page so everyone can know more about you.
- Customizable: You can fully customize the look and feel of your blog by editing the templates and CSS.
- Uses Golang Templates, TailwindCSS and pure plain CSS.
- Nostr: Publish your posts to Nostr for backing them up and getting more reach.
- Set your own key, or let Blogo generate one for you.
- Set your own relay list, or use the default list.
- No JS: Blogo doesn't use any JavaScript, so it's widely compatible and secure.
- CLI Tool: A simple CLI tool will allow you to create new post templates.
There are two ways to self-host Blogo:
The easiest way to self-host Blogo is by using Docker. I will try to publish a Docker image soon, but for now you can build it yourself:
- Get the docker-compose.yml:
wget https://raw.githubusercontent.com/pluja/blogo/main/docker-compose.yml
- Get the .env file:
wget https://raw.githubusercontent.com/pluja/blogo/main/env.example -O .env
Edit the
.env
file to fit your needs.
- Run blogo:
docker-compose up -d
Blogo is now available at http://localhost:3000.
For more complete instructions, read the usage guide.
- Run
docker exec -it blogo blogo -new my-post-slug
to create a new post. - The new post is available in the
articles
folder asmy-post-slug.md
.
Put all your markdown files in the articles
folder. You can also put your static files in the static
folder (you will need to bind it).
Using Blogo is pretty simple. Once you have blogo running, you can create new articles by just running blogo -new my-post-slug
, where my-post-slug
is the slug of the post (used in the url). This will create a new template in the articles
folder. Edit that file with your favorite text editor. Once done, save it and Blogo will take care of the rest (yes, it auto-reloads).
If you're on docker, you can run
docker exec -it blogo blogo -new my-post-slug
to create a new post.
Blogo uses YAML metadata to get the post info. The metadata is located at the top of the file, between ---
and ---
.
Here's a list of the available metadata fields:
Title
: The title of the post. This will also be used as the title for sharing and SEO.Author
: The author of the post.Summary
: The summary of the post. This is used in the index page. This will also be used as the description for sharing and SEO.Image
: The image of the post. This is used as the post thumbnail / header image. This will also be used as the thumbnail when sharing.Tags
: The tags of the post. Must be a list of strings. This will also be used as the keywords for SEO.Date
: The date of the post. Must be in the formatYYYY-MM-DD HH:MM
.Draft
: Whether the post is a draft or not. Must betrue
orfalse
.Layout
: The layout of the post. For now, onlypost
is available.NostrUrl
: The url to the Nostr content. If set to0
it will disable the posting of that article to Nostr even if Nostr publishing is enabled.
To create an about page, just create a file called about.md
in the articles
folder. Blogo will automatically detect it and create a link to it in the navbar.
If you set the PUBLISH_TO_NOSTR
variable in the .env
file to true
, Blogo will publish your posts to Nostr. By default, Blogo will generate an ephemeral key (changes on every restart) and use a default relay list.
You can change either of these defaults by setting any of these variables in the .env
file:
NOSTR_NSEC
- expects a validnsec
key. If you set this key, your posts will be always published for the same key, even on restarts.- You can generate a new Nostr key pair using
blogo -nkeys
.
- You can generate a new Nostr key pair using
NOSTR_RELAY_LIST
- expects a comma-separated list of relays (with protocol); eg.wss://relay1.com,wss://relay2.net
.
You can avoid publishing a particular post to Nostr by setting the
NostrUrl
metadata field in the post tofalse
or0
.
Posts are published to Nostr as Long-Form events following the definition in NIP-33.
You can add analytics to your blog by setting the BLOGO_ANALYTICS
variable in the .env
file to your analytics script. Blogo will automatically add it to the bottom of the page. Make sure to put it all in a single line!
BLOGO_ANALYTICS='<script defer src="https://my.analytics.site/script.js"></script>'
You can customize the look and feel of your blog by editing the templates and CSS.
The templates are located in the templates
folder:
base.html
: The base template. All other templates extend this one.- Receives: A Config struct with the name
Blogo
.
- Receives: A Config struct with the name
index.html
: The index template. This is the template used for the index page, where the posts are listed.- Receives: a list of articles []Article and the welcome text (string).
post.html
: The post template. This is the template used for the post reading page.- Receives: an Article.
about.html
: The about template. This is the template used for the about page.
The templates are written in Golang Templates, and the CSS is written in TailwindCSS and pure CSS. Feel free to tweak them to your liking.
The CSS is located in the static/css
folder.
The main content makes use of TailwindCSS classes, so you can just tweak that to your liking. Note: You will need to rebuild the TailwindCSS using npx
for new classes to apply.
The rendered Markdown is styled with pure CSS. You can tweak that in the
static/css/markdown.css
file. All markdwon is wrapped inside adiv
with themarkdown
id, so you can use that to style it.
You can easily add custom stylesheets to any page. Place the stylesheet into the static/css/
folder. Then, just use the extra
block from the template to link them. (take a look at the post.html
template and look for the extra
block to see how it's done).