StatiPy is a lightweight, command-line static site generator written in Python. It transforms your Markdown content into a clean, modern, and fast-loading static website. It's perfect for personal blogs, project documentation, or any website where content is the primary focus.
- Markdown-First: Write your content in simple Markdown files.
- Template-Based: Uses a single HTML template for consistent page layout.
- Recursive Processing: Automatically finds and processes all content and static files in their respective directories.
- Standard Markdown Support: Handles headings, paragraphs, ordered and unordered lists, code blocks, blockquotes, bold and italic text, links, and images.
- Built-in Dev Server: Comes with a simple command to build the site and serve it locally.
- Zero Dependencies: Built entirely with the Python standard library.
-
Clone the repository:
git clone <your-repository-url> cd <your-repository-directory>
-
Prerequisites: Ensure you have Python 3 installed. No other dependencies are required.
python3 --version
-
Add Your Content:
- Place your Markdown files (
.md
) in thecontent/
directory. You can create subdirectories to organize your content. - The title of each page is extracted from the first H1 heading (e.g.,
# My Page Title
).
- Place your Markdown files (
-
Add Static Files:
- Place your static assets (CSS, images, etc.) in the
static/
directory. The directory structure will be preserved in the final output.
- Place your static assets (CSS, images, etc.) in the
-
Customize the Template:
- Modify
template.html
to change the overall layout of your site. Use the{{ Title }}
and{{ Content }}
placeholders to indicate where the page title and content should be inserted.
- Modify
-
Build and Serve:
- Run the build script from the project root:
./main.sh
- This command will:
- Delete the old
docs/
directory. - Generate your site from the
content/
andstatic/
directories into thedocs/
directory. - Start a local web server.
- Delete the old
- You can view your site at
http://localhost:8888
.
- Run the build script from the project root:
If you plan to deploy your site to a subdirectory (e.g., yourdomain.com/my-site/
), you can specify a basepath
to ensure all links and asset paths are correct.
python3 src/main.py /my-site/
This will prepend /my-site/
to all root-relative URLs in your generated HTML.