A lightweight, easy-to-use static site generator (SSG) built with Python. This SSG is designed to help developers quickly generate static HTML websites from Markdown files.
- Converts Markdown files (
.md) into static HTML pages. - Recursively processes all Markdown files in
content, generating HTML files in the corresponding folder structure withinpublic. - Copies all static files from the
staticdirectory to thepublicdirectory. - Lightweight and fast, ideal for small sites.
- Python 3.x
-
Clone the repository:
git clone https://github.com/mdelgadonyc/ssg-python.git cd ssg-python
-
Prepare your content:
- Place your
.mdfiles in thecontentdirectory. Each file should have a title in Markdown header format (# Title) at the top for processing. - Store any images, CSS, or other static files in the
staticdirectory.
- Place your
-
Build the static site:
./main.sh
- This will generate the static HTML files in the
publicdirectory. Each.mdfile incontentwill be processed, and the resulting.htmlfile will be saved inpublic, mirroring the directory structure ofcontent.
- This will generate the static HTML files in the
-
Preview your site:
- The project serves the generated HTML pages on
localhostat port8888by default. Whilemain.shis running, you can open your browser and navigate tohttp://localhost:8888to preview the site.
- The project serves the generated HTML pages on
This project includes sample files to get you started:
- Markdown files:
index.mdin the root ofcontentand anotherindex.mdincontent/majesty. - Static assets: An image (
rivendell.png) and a CSS file (index.css) instatic.
The generated HTML pages will be saved in public/index.html and public/majesty/index.html, respectively.
After running ./main.sh, your project structure should look like this:
ssg-python/
├── content/
│ ├── index.md
│ └── majesty/
│ └── index.md
├── public/
│ ├── index.html
│ ├── majesty/
│ │ └── index.html
│ ├── images/
│ │ └── rivendell.png
│ └── index.css
├── static/
│ ├── images/
│ │ └── rivendell.png
│ └── index.css
├── template.html
└── main.sh
- File Permissions: Ensure
main.shhas executable permissions. You may need to runchmod +x main.shbefore running the script.
We welcome contributions! To contribute:
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch). - Commit your changes (
git commit -m "Add a new feature"). - Push to the branch (
git push origin feature-branch). - Open a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
Happy site building!