This Python script generates a static website using HTML templates and YAML files for page attributes. The script is flexible, allowing for custom headers, footers, and content to be defined on a per-page basis.
- Python 3.x
- PyYAML (for handling YAML files)
- To install PyYAML, run:
pip install PyYAML
- Generates pages from HTML templates
- Supports custom headers and footers
- Fetches attributes from YAML files to populate templates
- Handles errors gracefully, with debug output for easy troubleshooting
Clone this repository:
Run the script:
python3 build.py
- Add your HTML template into the templates folder.
- Add the corresponding YAML file with page attributes in the attributes folder.
- If you want a custom header or footer, add those into the headers and footers folders respectively.
- Run build.py to generate the new page.
To test on local environment. Run the comand below in the website directory
python3 -m http.server
You can now view thew website by navigating to http://127.0.0.1:8000 or http://localhost:8000 in your web browser.
You also test using VS Code Live Server: https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer