mettu (మెట్లు, /ˈmɛt.t̪u/) is a simple static site generator that uses Python for backend processing and Vite for frontend development, with Tailwind and DaisyUI for styling. It allows you to create static websites using markdown files.
"mettu" is a Telugu word meaning a stair or step. It felt like a great name given that this project is a step towards building tools myself, and convieniently, a step towards making a site!
- Python 3.x
- Node.js and npm
- Vite
- Tailwind CSS and DaisyUI
-
Clone the repository
-
Install the required dependencies
npm install
- Note: Python dependencies are installed by default by the initialising script.
-
Configure Environment Variables (Optional - for S3 Upload)
Copy the example environment file:
cp .env.example .env
Edit
.envto add your S3 bucket credentials. This is required if you want optimized images to be uploaded to an S3-compatible bucket. -
Edit the
config.yamlfile to set your site name, author, runtime configuration, navigation links, syntax highlighting theme, and DaisyUI theme preferences.runtime: python_executable: "python3" # optional, defaults to python3 when omitted theme: default: "cupcake" # active theme used for data-theme include: ["cupcake", "dracula"] # DaisyUI presets to load custom: mytheme: primary: "#570df8" secondary: "#f000b8" accent: "#37cdbe" images: formats: - webp - jpg
Optionally, define site-wide font imports and the families to apply:
fonts: imports: - "https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&family=Space+Grotesk:wght@500;700&display=swap" families: body: "'Inter', sans-serif" heading: "'Space Grotesk', sans-serif" mono: "'JetBrains Mono', monospace" syntax: pygments_theme: "dracula" # Controls syntax.css and markdown highlighting
You can still override the interpreter via the
PY_EXECUTABLEenvironment variable if needed, but the config file is the canonical source. -
Create markdown files in the
contentdirectory.- Dynamic Routing: Nested directories are supported (e.g.,
content/blog/post-1.mdbecomes/blog/post-1.html). - Each file should start with frontmatter similarly to the given examples.
- Dynamic Routing: Nested directories are supported (e.g.,
-
Templates and svg icons are located in the
templatesdirectory. You can customize them as needed. -
Assets like css, images, etc are placed in the
assetsdirectory.- Image Optimization: Images in
assets/imgare automatically processed and converted to WebP. - S3 Upload: If configured in
.env, processed images are uploaded to the specified S3 bucket.
- Image Optimization: Images in
-
Web Feeds (RSS / Atom)
- Feeds are dynamically generated during build. You can customize them in
config.yamlusing thefeedskey:feeds: - filename: "feed.xml" layouts: ["post"] title: "My Site Feed" subtitle: "A collection of my thoughts and findings" content: true # Set to true to include the full HTML content of each post
- Default Feeds: If the
feedskey is omitted, three feeds will be generated:/feed.xml(all posts and TILs),/blog/feed.xml(blog posts only), and/til/feed.xml(TIL posts only). - Excluding Pages: Add
feed: falseto a markdown page's frontmatter to exclude it from all feeds. - Styling: The feed uses
public/pretty-feed-v3.xslto render beautifully when opened directly in a browser.
- Feeds are dynamically generated during build. You can customize them in
-
Run the development server
npm run dev
-
Build the site for production
npm run build