Skip to content

A lightweight, file-based PHP blog system with built-in admin interface powered by VS Code editor. No database required - write posts in Markdown, manage content through a web-based dashboard, and deploy anywhere PHP runs. Features multilingual support, RSS feeds, tag system, and secure authentication.

License

Notifications You must be signed in to change notification settings

jurgen178/BitBlog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

BitBlog - Lightweight PHP Blog System

A lightweight, file-based blog system written in PHP with built-in admin interface.

License: MIT PHP Version

✨ Features

  • πŸ“ File-based: No database required - posts stored as Markdown files
  • 🎨 Built-in Editor: Web-based admin interface for writing posts
  • 🌍 Multilingual: Built-in i18n support (English, German)
  • 🏷️ Tag System: Organize posts with tags and tag clouds
  • πŸ“± Responsive: Mobile-friendly design
  • πŸ”’ Secure: CSRF protection, bcrypt password hashing, session management
  • πŸš€ Fast: Cached index for quick page loads
  • πŸ“‘ RSS Feed: Automatic RSS generation
  • πŸ—ΊοΈ Sitemap: SEO-friendly XML sitemap
  • πŸ” Private Posts: Share drafts via secure token URLs


blog

admin

editor

signature-editor

settings

index3

index2


πŸš€ Quick Start

Prerequisites

  • PHP 8.0 or higher (tested with PHP 8.4)
  • Web server with PHP support (Apache, Nginx, or PHP built-in server)

Installation

  1. Clone the repository:

    git clone https://github.com/jurgen178/bitblog.git
    cd bitblog
  2. Set up admin credentials:

    First time setup - visit http://localhost:8000/admin.php and the setup wizard will guide you through creating an admin account.

    OR manually edit src/Config.php:

    public const ADMIN_USER = 'yourusername';
    public const ADMIN_PASSWORD_HASH = '$2y$12$...'; // Use generate_password.php
  3. Start the development server (local testing):

    php -S localhost:8000
  4. Access your blog:

Production Deployment

Linux/Apache

  1. Upload files to your web server:

    • Copy all files to your web server's document root
    • Ensure the web server user (e.g., www-data, apache) has write permissions for:
      • The entire BitBlog directory (for generating index files, static pages, etc.)
      • cache/ directory (for generated cache files)
      • content/ directory (for creating/editing posts)
      • settings.json (for saving configuration)
  2. Set permissions:

    cd /path/to/bitblog
    chmod -R 775 .
    chown -R www-data:www-data .
  3. Configure Apache:

    • Point document root to the BitBlog directory
    • Enable .htaccess if using URL rewriting
    • Ensure PHP is enabled and version 8.0+ is available
  4. Security:

    • Set up admin credentials in src/Config.php
    • Use HTTPS in production
    • Consider restricting /admin.php access by IP if possible

Windows/IIS

  1. Copy files to IIS:

    • Copy all files to your IIS website directory (e.g., C:\inetpub\wwwroot\bitblog)
    • Ensure the IIS application pool identity (e.g., IIS_IUSRS, NETWORK SERVICE) has write permissions for:
      • The entire BitBlog directory (for generating index files, static pages, etc.)
      • All subdirectories and files
  2. Set permissions (using PowerShell):

    # Grant write access to entire BitBlog directory
    icacls "C:\inetpub\wwwroot\bitblog" /grant "IIS_IUSRS:(OI)(CI)M" /T
  3. Configure IIS:

    • Install PHP using Web Platform Installer or manually
    • Enable PHP FastCGI in IIS
    • Set default document to index.php
    • Configure web.config for URL rewriting (already included in repo)
  4. Security:

    • Set up admin credentials in src\Config.php
    • Enable HTTPS binding in IIS
    • Consider IP restrictions for /admin.php in IIS Manager

πŸ“‚ Project Structure

blog-test/
β”œβ”€β”€ index.php              # Main blog frontend
β”œβ”€β”€ admin.php              # Admin interface router
β”œβ”€β”€ src/                   # Application classes
β”‚   β”œβ”€β”€ Config.php         # Site configuration
β”‚   β”œβ”€β”€ Content.php        # Content management
β”‚   β”œβ”€β”€ Router.php         # URL routing
β”‚   └── ...
β”œβ”€β”€ admin/                 # Admin interface files
β”‚   β”œβ”€β”€ login.php          # Login form
β”‚   β”œβ”€β”€ editor.php         # Post editor
β”‚   └── admin.css          # Admin styles
β”œβ”€β”€ templates/             # HTML templates
β”œβ”€β”€ content/               # Your content
β”‚   β”œβ”€β”€ posts/             # Blog posts (.md files)
β”‚   └── pages/             # Static pages
β”œβ”€β”€ cache/                 # Generated cache files
└── assets/                # CSS, images, etc.

πŸ“ URL Structure

  • Homepage: / or /index.php
  • Single Post: /index.php?id=123
  • Tag Archive: /index.php?tag=php
  • Page: /index.php?page=about
  • RSS Feed: /feed.xml or /index.php?feed=1
  • Sitemap: /sitemap.xml
  • Admin Panel: /admin.php

πŸ”§ Configuration

Edit src/Config.php to customize defaults:

public const SITE_TITLE = 'Your Blog Name';
public const POSTS_PER_PAGE = 5;
public const RSS_POSTS_LIMIT = 100;
public const TIMEZONE = 'Europe/Berlin';
public const DEFAULT_LANGUAGE = 'en'; // or 'de'

Runtime settings can also be changed via the admin panel (/admin.php?settings).

πŸ›‘οΈ Security

  • Password Hashing: Uses bcrypt (cost 12) for secure password storage
  • CSRF Protection: All forms protected against CSRF attacks
  • Session Security: Secure session management with httponly cookies
  • Input Validation: All user inputs are sanitized and validated
  • Private Posts: Secure token-based access for draft sharing

⚠️ Important Security Notes:

  • Change admin credentials before production deployment
  • Use HTTPS in production
  • Keep PHP updated

🌍 Internationalization

BitBlog supports multiple languages out of the box:

  • English (en)
  • German (de)

To add a new language:

  1. Copy src/lang/template.json to src/lang/xx.json (e.g., fr.json)
  2. Translate all strings
  3. Set _locale field (e.g., "_locale": "fr_FR")

See TRANSLATION_GUIDE.md for details.

πŸ“– Writing Posts

Using the Web Editor (Recommended)

  1. Access the admin panel:

    • Navigate to http://yoursite.com/admin.php
    • Log in with your credentials
  2. Create a new post:

    • Click "πŸ“ New Post" in the admin panel
    • Fill in the title, date, and status (draft/published/private)
    • Add tags to organize your content
    • Write your content using the built-in Monaco Editor (Visual Studio Code editor)
    • See live preview of your post in real-time
  3. Editor features:

    • Markdown toolbar: Quick buttons for bold, italic, code, links, tables
    • Live preview: See rendered output as you type
    • Fullscreen mode: Distraction-free writing (F11)
    • Dark/Light theme: Switch editor theme
    • Font size control: Adjust text size (A+/A-)
    • Keyboard shortcuts: Ctrl+B (bold), Ctrl+I (italic), Ctrl+K (link), Ctrl+S (save)
  4. Post status:

    • Published: Visible to everyone
    • Draft: Hidden from public, only visible in admin
    • Private: Only accessible via secure token URL (perfect for sharing drafts)

Manual File Creation

Posts are Markdown files with YAML front matter stored in content/posts/:

---
title: My Blog Post
status: published
tags: [php, blog, web]
---

# My Blog Post

Content goes here in **Markdown** format.

File naming convention: YYYY-MM-DDTHHMM.ID.md (e.g., 2025-11-15T1430.123.md)

  • The date in the filename is in UTC
  • The ID is auto-generated and unique

🎯 Admin Features

  • πŸ“ Editor: Write posts in Markdown with live preview powered by Visual Studio Code
  • πŸ“Š Dashboard: Overview of all posts with status
  • πŸ”„ Index Rebuild: Regenerate cache after bulk changes
  • πŸ—‘οΈ Delete Posts: Remove posts with confirmation
  • πŸ‘€ Preview: View posts before publishing

πŸ“± Responsive Design

  • Mobile-friendly interface
  • Tag cloud for easy navigation
  • Pagination for large blogs
  • Clean, readable typography

πŸ” SEO Features

  • Automatic sitemap generation
  • RSS feed for subscribers
  • Clean URLs
  • Meta tags and descriptions
  • Performance optimization with caching

🚦 Post Status

  • published: Visible on the blog
  • draft: Hidden from public view
  • private: Accessible only via direct link

πŸ“‹ Requirements

  • PHP 8.0+ (tested with PHP 8.4)
  • No database required
  • Web server with PHP support

🎨 Customization

  • Edit templates in /templates/ for layout changes
  • Modify CSS in /assets/style.css for styling
  • Admin interface styles in /admin/admin.css

🀝 Contributing

Contributions are welcome! Please read CONTRIBUTING.md and DEVELOPER_STANDARDS.md before submitting PRs.

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • Built with ParsedownExtra for Markdown processing
  • Inspired by simple, file-based CMS systems

BitBlog - Lightweight, secure, and fast!

About

A lightweight, file-based PHP blog system with built-in admin interface powered by VS Code editor. No database required - write posts in Markdown, manage content through a web-based dashboard, and deploy anywhere PHP runs. Features multilingual support, RSS feeds, tag system, and secure authentication.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published