Skip to content

PoisonMunna/BlogGenerator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📝 Blog Generator - Static Site Generator

Python Version License Platform

A powerful static blog generator that converts Markdown files into a complete HTML website with tags, archive pages, and responsive design.

Features

  • Markdown to HTML Conversion - Write posts in simple Markdown format
  • Frontmatter Support - Add metadata (title, date, tags, excerpt) to each post
  • Tag System - Automatic tag pages and tag cloud
  • Archive Page - Posts grouped by year
  • Responsive Design - Works on mobile, tablet, and desktop
  • Code Syntax Highlighting - Clean code block styling
  • Sidebar with Statistics - Shows total posts and tags
  • Individual Post Pages - Each post gets its own HTML page
  • Local Server Support - Preview your blog instantly

Quick Start

Prerequisites

  • Python 3.7 or higher
  • Install markdown library: pip install markdown

Installation

  1. Clone the repository:
    git clone https://github.com/poisonmunna/bloggenerator.git
    cd blog-generator

  2. Install dependencies:
    pip install markdown

  3. Create a sample post:
    python blog_generator.py --sample

  4. Generate your blog:
    python blog_generator.py

  5. View your blog:
    cd output
    python -m http.server 8000
    Then open http://localhost:8000 in your browser

Writing Blog Posts

image

Post Format

Create .md files in the content folder with this structure:


title: Your Post Title
date: 2024-01-15
tags: python, tutorial, blog
excerpt: A short description of your post

Your Main Heading

Your content goes here...

Subheading

  • List item 1
  • List item 2

[code block here with triple backticks]

print("Code blocks work!")

[close triple backticks]

Example Post

image

Save as content/my-first-post.md:


title: Learning Python
date: 2024-06-16
tags: python, programming, beginner
excerpt: A beginner's guide to Python programming

Learning Python

Python is a great language for beginners!

Why Python?

  • Easy to learn
  • Versatile
  • Large community

Code Example

[code block with triple backticks]
name = "John"
print(f"Hello, {name}!")
[close triple backticks]

Generated Pages

Page Description
index.html Homepage showing all posts with excerpts
archive.html All posts grouped by year
tags.html Index page showing all tags
tags/[tag].html Posts filtered by specific tag
posts/[post].html Individual post pages

Command Line Usage

Command Description
python blog_generator.py Generate the blog
python blog_generator.py --sample Create a sample post
python blog_generator.py --help Show help

Folder Structure

blog-generator/

├── blog_generator.py # Main script
├── content/ # Put your .md files here
│ ├── welcome.md
│ ├── post1.md
│ └── post2.md
├── output/ # Generated HTML
│ ├── index.html
│ ├── archive.html
│ ├── tags.html
│ ├── posts/
│ │ ├── welcome.html
│ │ ├── post1.html
│ │ └── post2.html
│ └── tags/
│ ├── Python.html
│ └── Tutorial.html
└── README.md

Sample Output When Running

image

==================================================

📝 BLOG GENERATOR

==================================================

📂 Loading posts...
✅ Loaded 3 posts
✅ Found 5 tags

📄 Generating pages...

✅ Generated: index.html
✅ Generated: posts/welcome.html
✅ Generated: posts/python-tips.html
✅ Generated: tags/Python.html
✅ Generated: tags/Tutorial.html
✅ Generated: tags.html
✅ Generated: archive.html

==================================================

🎉 BLOG GENERATED SUCCESSFULLY!

==================================================

📁 Output: C:\blog-generator\output

🌐 To view your blog:
cd output
python -m http.server 8000
Then open http://localhost:8000

==================================================

Publishing Your Blog

Option 1: GitHub Pages (Free)

cd output
git init
git add .
git commit -m "Initial blog"
git remote add origin https://github.com/username/username.github.io.git
git push -u origin main

Then visit: https://username.github.io

Option 2: Netlify (Free)

  1. Go to netlify.com
  2. Drag and drop your output folder
  3. Your blog is live instantly

Option 3: Vercel (Free)

  1. Install Vercel CLI: npm install -g vercel
  2. cd output
  3. vercel --prod

Troubleshooting

Error: No module named 'markdown'

Solution: pip install markdown

No posts found

Solution: Run python blog_generator.py --sample first

Port 8000 already in use

Solution: python -m http.server 8080

Posts not showing

Solution: Make sure .md files are in content folder

Styling Features

  • Gradient Header - Purple to blue gradient background
  • Card Layout - Each post appears in a card with shadow
  • Hover Effects - Cards lift on hover
  • Tag Buttons - Colorful, clickable tags
  • Responsive Grid - Adapts to screen size
  • Code Blocks - Styled with background and monospace font

Performance

  • Generation Speed: ~0.1 seconds per post
  • Memory Usage: ~50 MB for 1000 posts
  • Output Size: ~10 KB per post

Contributing

Contributions are welcome!

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE file for more information.

Contact

Your Name - 123razz321@gmail.com

Project Link: https://github.com/poisonmunna/bloggenerator

Show Your Support

If this project helped you create your blog, please give it a star on GitHub!


Made with Python | Write in Markdown, Publish in HTML! 📝

About

A powerful static blog generator that converts Markdown files into a complete HTML website with tags, archive pages, and responsive design.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors