
A minimal static blog that automatically cross-posts to Telegram using GitHub Pages and GitHub Actions.
- π Static Blog: Fast, lightweight blog built with vanilla HTML/CSS/JS
- π€ Telegram Integration: Automatic cross-posting to Telegram channels with images
- π GitHub Actions: Automated builds and deployments
- π± Responsive Design: Mobile-friendly layout
- π SEO Ready: Includes sitemap, RSS feed, and meta tags
- π¨ Dark Theme: Modern dark theme with smooth animations
See this project in action: Telegram Channel Example
git clone https://github.com/your-username/pages-telegram-blog.git
cd pages-telegram-blog
- Go to Settings β Pages in your GitHub repository
- Set source to Deploy from a branch
- Select branch: main and folder: / (root)
- Create a bot with @BotFather on Telegram
- Get your bot token
- Add your bot to your channel as an admin
- Get your channel ID (numeric, e.g.,
-1001234567890
)
In your GitHub repository, go to Settings β Secrets and variables β Actions and add:
TELEGRAM_BOT_TOKEN
: Your bot token from BotFatherTELEGRAM_CHAT_ID
: Your channel's numeric ID
mkdir posts/my-first-post
Create posts/my-first-post/meta.json
:
{
"title": "My First Post",
"description": "This is my first blog post!",
"date": "2025-01-01",
"tags": ["blog", "first-post"],
"image": "cover.png",
"telegram_message": "Check out my first blog post! π"
}
Create posts/my-first-post/index.html
with your blog content and add a cover.png
image.
.
βββ π index.html
βββ π posts/
β βββ π post-slug/
β βββ π index.html
β βββ π meta.json
β βββ πΌοΈ cover.png
βββ π assets/
β βββ π css/
β β βββ π site.css
β βββ π img/
β βββ πΌοΈ og-default.png
βββ π scripts/
β βββ π build_index.py
β βββ π changed_posts.py
β βββ π telegram_post.py
βββ π .github/workflows/
β βββ π§ build.yml
β βββ π§ post-to-telegram.yml
βββ π feed.xml
βββ π sitemap.xml
βββ π robots.txt
- Python 3.11+
- Git
git clone https://github.com/your-username/pages-telegram-blog.git
cd pages-telegram-blog
pip install -e ".[dev]"
pre-commit install
This project uses pre-commit hooks to maintain code quality:
- Ruff: Code formatting and linting
- MyPy: Static type checking
- Prettier: HTML/CSS/JS formatting
- Markdownlint: Markdown linting
- Bandit: Security scanning
Hooks run automatically on commit, or manually:
pre-commit run --all-files
python scripts/build_index.py
python scripts/telegram_post.py my-post-slug
- Create a new directory:
posts/your-post-slug/
- Add required files:
index.html
: Your blog post contentmeta.json
: Post metadatacover.png
: Post cover image
- Commit and push to trigger auto-build and Telegram posting
{
"title": "Required: Post title",
"description": "Optional: Post description for SEO",
"date": "Required: YYYY-MM-DD format",
"tags": ["Optional", "Array", "Of", "Tags"],
"image": "Optional: image filename (defaults to cover.png)",
"telegram_message": "Optional: Custom Telegram caption"
}
Edit assets/css/site.css
to customize the appearance. The current theme uses CSS custom properties for easy color scheme modifications.
Update the constants in scripts/build_index.py
:
SITE_DESC
: Site description for SEO- Page titles and metadata
Customize Telegram post format in scripts/telegram_post.py
or use the telegram_message
field in post metadata.
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
This project is licensed under the MIT License - see the LICENSE file for details.
Please see SECURITY.md for security considerations and reporting vulnerabilities.
- π Check the documentation
- π Report bugs
- π‘ Request features
- π¬ Ask questions
Made with β€οΈ for the blogging community