README - Getting Started with DSBG

How to install and use Dead Simple Blog Generator.

DSBG (Dead Simple Blog Generator) is a free and open-source command-line tool that transforms a directory of Markdown and/or HTML files into a static website. It's designed for ease of use, allowing you to quickly create and deploy a personal blog, documentation site, or a website with minimal configuration.

The ethos behind it is to automate your virtual presence as much as possible, while retaining control over the created content. To that end, the following features are available:

TOC

Installation

To get started with DSBG, you'll first need to install it on your system. If you have Go installed, you can use the following command in your terminal:

go install github.com/tesserato/dsbg@latest

This command will download and install the latest version of DSBG.

Alternatively, you can download a pre-built binary for your operating system from the releases page and add it to your system's PATH environment variable or place it in the same directory where your source files are located.

After installation, verify that DSBG is working correctly by running the help command:

dsbg -h

This command will print the help message, displaying all available options and flags.

Usage

Assuming you are running dsbg from a directory containing a content folder with your Markdown or HTML files, just running dsbg without any flags will generate a website in a folder named public. You'll probably want to change the name and description of the blog, in which case you can use the -title and -description flags:

dsbg -title "My First Blog" -description "A simple test blog"

Creating a Markdown Template

To create a new Markdown file with a pre-filled frontmatter template, run:

dsbg -template -title "My Awesome Post" -description "A sample template"

This command generates a Markdown file named with the current date in the current directory. You can use this as a starting point to fill with content. If no title is given, the file will be named with the date.

Building a Blog with a Theme and Watch Mode

To build a blog using a predefined theme (dark) and enable watch mode (which automatically rebuilds the site on changes), use:

dsbg -title "My Awesome Blog" -description "My blog description" -watch -style dark

This command generates a blog with the "dark" theme and watches for changes in the content folder, rebuilding the website on each change. A local server will also start to serve the blog in your browser.

Building a Blog with Custom CSS

To use a custom CSS file to style your blog, use:

dsbg -title "My Awesome Blog" -description "My blog description" -watch -css-path path/to/custom-style.css

This command creates a blog that is watched for changes, while using a custom CSS file for styling. Make sure that the path given with -css-path is the correct path to your CSS file.

Including Custom HTML Elements

To include custom HTML elements (like analytics code, headers, or footers) in your blog, use:

dsbg -title "My Awesome Blog" -description "My blog description" -watch -elements-top elements-top.html -elements-bottom elements-bottom.html

This command adds the contents of elements-top.html at the top of each generated page, and the content of elements-bottom.html at the bottom of each generated page. The files given to these flags must be basic HTML files.

Special "PAGE" Tag Usage

If your source files are in HTML and have obscure dependencies (beyond the usual links to images, CSS, and JavaScript), you can add the tag PAGE to your Markdown or HTML file. This tag tells DSBG to copy the entire directory containing that file and all its contents to the output folder.

Features

Here's a breakdown of the core features of DSBG:

Command-Line Arguments

The following flags are available when using the dsbg command-line tool:

Flag Description Default Value
-title The title of your blog or website. Blog
-base-url The base URL for your website (e.g., https://example.com). Required for generating a correct RSS feed. none
-description A brief description of your blog or website. Can be in Markdown format. This is my blog
-input-path The path to the directory containing your source content files (Markdown and HTML). content
-output-path The path to the directory where the generated website files will be saved. public
-date-format The format for displaying dates on the website using Go's time formatting syntax (e.g., 2006-01-02). 2006 01 02
-index-name The filename for your main index page. index.html
-css-path The path to a custom CSS file to override default styles. none
-js-path The path to a custom JavaScript file to add functionality to your site. none
-favicon-path The path to a custom favicon file (e.g., .ico) for your site. none
-ignore-tags-from-paths Disable extracting tags from directory names. false
-keep-date-in-paths Do not remove date patterns from the generated file paths. false
-keep-date-in-titles Do not remove date patterns from article titles. false
-open-in-new-tab Open external links in new browser tabs. false
-style Choose a pre-defined theme: default, dark, or colorful. default
-elements-top The path to an HTML file with elements to include at the top of each generated page (e.g., analytics scripts). none
-elements-bottom The path to an HTML file with elements to include at the bottom of each generated page. none
-help Display this help message and exit. false
-watch Enable watch mode, automatically rebuild the site on changes, and start a local server. false
-template Create a basic Markdown template file with frontmatter in the current directory. false
-sort Define the sorting order of articles on the index page. Options: date-created, reverse-date-created, date-updated, reverse-date-updated, title, reverse-title, path, reverse-path. date-created
-x-handle X (formerly Twitter) handle for profile link and share buttons. none
-bluesky-handle Bluesky handle for profile link and share buttons. none
-threads-handle Threads handle for profile link and share buttons. none
-mastodon-handle Mastodon handle for profile link and share buttons. none

Caveats

Contributing

Contributions are welcome! If you find a bug, have a feature request, or would like to improve the documentation, feel free to submit a pull request or create an issue on GitHub.

If you use DSBG in your own project, please consider giving it a star on GitHub and sharing it with your friends. Also, send me the link to your project so I can add it to the list of projects that use DSBG.

If you come up with a nice theme for DSBG, please contact me so I can add it to the list of themes.

Blogs using DSBG

My personal blog, and the motivation for DSBG. If you want to know more about why I made this, check out Why I made yet another blog generator.