leafy

command module
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 10, 2025 License: MIT Imports: 6 Imported by: 0

README ΒΆ

πŸ› οΈ Leafy: Minimal Static Site Generator

image

Leafy is a minimal static site generator written in Go. It enables the rapid creation of a basic HTML site by processing Markdown content against an HTML template.


πŸ“‹ Requirements

  • Go 1.20+ installed on your system.
  • Basic knowledge of Markdown and HTML/Go Templates (.tmpl).

πŸš€ Installation

Install the latest version of the Leafy binary:

go install github.com/LazyCode2/leafy@latest

βš™οΈ Usage Guide

1. Initialize Project Structure

Run the following command in your desired project directory to create the necessary structure:

leafy --init

This command creates the following required directory structure:

  β”œβ”€β”€ content/ (For Markdown files)
  β”œβ”€β”€ output/ (Generated HTML site destination)
  └── template/ (For Go template files)

2. Add Content

Place your Markdown source file in the content folder. πŸ“‚ Example Content Folder

content/
β”œβ”€β”€ _index.md       # Homepage content
β”œβ”€β”€ about.md        # Example page
└── contact.md      # Another example page

3. Define Template

Create your HTML template file inside the template folder (e.g., template/default.tmpl).

The template must include the {{ .Data }} placeholder where the processed Markdown content will be inserted.

Example Template (template/default.tmpl):

<!DOCTYPE html>
<html>
<head>
    <title>{{ .Title }}</title>
</head>
<body>
    <h1>My Static Site</h1>
    {{ .Data }} 
</body>
</html>

Example Index Template (template/index.tmpl):

<!DOCTYPE html>
<html>
<head>
    <title>{{ .Title }}</title>
</head>
<body>
    <h1>My Static Site</h1>
    {{ .Data }} 
</body>
</html>

4. Build Site

Generate the final HTML file by executing the build command:

leafy --build

The resulting HTML file (index.html) will be placed in the output/ directory.

Documentation ΒΆ

The Go Gopher

There is no documentation for this package.

Directories ΒΆ

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL