/dudu

Primary LanguageGo

Dudu

FAQ

Believe me, I get asked these all the time.

What is Dudu?

Dudu is a static site generator. It takes pandoc markdown files and renders them into templated HTML, ready to be served as a static site.

Why Dudu?

The motivation for Dudu came from realizing there are simply not enough static site generators. In all seriousness, it was inspired by my good friend Jacob Strieb's similar project for his personal website. In fact, I borrowed directly from his bash script to replicate the functionality of compiling pandoc markdown in Dudu as dudu build. The point of making Dudu was really just because I thought it would be fun to take the work done by Jacob and rebuild it in Go and add new functionality.

Oh, did you mean why the name? Sorry to disappoint, but there's no fun backstory here- just thought it was fun to say.

What makes it different from other static site generators?

The emphasis on pandoc is the main aspect of Dudu that sets it apart from other static site generators. It is also rather lightweight and minimal (which is code for not a ton of useful features). Speaking of features...

Features

  • Hot Reloading
  • Incremental Builds
  • Project Scaffolding

Getting Started

First, consider why you are using this obscure and opinionated static site generator when so many objectively better alternatives exist.

This package uses the embed package, which is only available in Go version 1.16 and higher.

Installation (using go install)

  • go install github.com/lsnow99/dudu/cmd/dudu@latest

Installation from source

  • git clone https://github.com/lsnow99/dudu
  • go build -o dudu cmd/dudu
  • mv dudu $GOBIN

(Assumes $GOBIN is set and in your $PATH)

You can now run dudu new to create a new project

Within the new project folder, some default files will be created for you:

.
├── md                          # Here is where your markdown content lives
│   ├── index.html              # Landing page. Does not hot reload
│   ├── 404.html                # Standard 404 page, redirects to /
│   ├── style.css               # Global style file
└── resources                   # This folder contains files for templating
    ├── code-highlight.theme    # Theming file for code markdown
    ├── footer.html             # Footer to be injected at the bottom of each content page
    ├── hotreload.html          # Script injected when running dudu serve
    ├── navbar.html             # Navbar to be injected at the top of each content page
    └── template.html           # Main template file for all content pages

A common pattern (among the two current users) is to have subfolders within md to organize your content, and within these subfolders add your posts/pages as .md files.

Usage

  • dudu new - Scaffolds a new Dudu project
  • dudu serve - Start the hot-reloading webserver, available at http://localhost:8080
  • dudu build - Generates the static site, by default outputting to static/
  • dudu help - Show all command options