Personal website
This script automates the process of building a static website from markdown files and serving it locally for development and testing purposes.
- Converts Markdown files to HTML.
- Supports live reloading in development mode.
- Serves the website locally.
- Includes a layout template for consistent page design.
- Handles static assets like CSS and images.
- Install with
pip install -r requirements.txt.
-
Build the Website
Run the script without any arguments to build the website. This will convert all Markdown files in the
src/pagesdirectory to HTML, apply the layout template, and copy static assets to thebuilddirectory.python build.py -
Serve the Website Locally
To build the website and serve it locally on a specified port (default is 8000), use the
--serveflag.python build.py --serveOptionally, specify the port with
--port:python build.py --serve --port 8080 -
Development Mode
Enable development mode with the
--devflag. This mode can be combined with--serveto facilitate live reloading.python build.py --dev --serve
src/: Contains the source files for the website.pages/: Markdown files to be converted into HTML.index.html: Layout template.css/,img/: Directories for static assets.
build/: Destination directory for the built website.
- Modify the
index.htmllayout template to change the website's look and feel. - Add more static directories in the
STATIC_DIRSlist as needed. - Enhance the
RewriteUrlsHTTPRequestHandlerclass for additional URL rewriting rules.