Skip to content
forked from pluja/blogo

A lightweight blogging engine that backs itself up to Nostr!

License

Notifications You must be signed in to change notification settings

chefnaphtha/blogo

 
 

Repository files navigation

🎈 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!

Features

  • 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.

Self-hosting

Read this on Blogo

There are two ways to self-host Blogo:

Docker

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:

  1. Get the docker-compose.yml:
wget https://raw.githubusercontent.com/pluja/blogo/main/docker-compose.yml
  1. Get the .env file:
wget https://raw.githubusercontent.com/pluja/blogo/main/env.example -O .env

Edit the .env file to fit your needs.

  1. Run blogo:
docker-compose up -d

Blogo is now available at http://localhost:3000.

Create your first article

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 as my-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).

Usage

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.

Metadata fields

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 format YYYY-MM-DD HH:MM.
  • Draft: Whether the post is a draft or not. Must be true or false.
  • Layout: The layout of the post. For now, only post is available.
  • NostrUrl: The url to the Nostr content. If set to 0 it will disable the posting of that article to Nostr even if Nostr publishing is enabled.

About page

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.

Publish to Nostr

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 valid nsec 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.
  • 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 to false or 0.

Posts are published to Nostr as Long-Form events following the definition in NIP-33.

Add analytics

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>'

Customization

You can customize the look and feel of your blog by editing the templates and CSS.

Templates

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.
  • 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.
  • about.html: The about template. This is the template used for the about page.

Styles

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 a div with the markdown id, so you can use that to style it.

Adding more stylesheets

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).

About

A lightweight blogging engine that backs itself up to Nostr!

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 68.4%
  • HTML 28.3%
  • Dockerfile 2.1%
  • Other 1.2%