simpleblogger v0.1.2
SimpleBlogger
note: this project is still under-development
SimpleBlogger is a lightweight JavaScript tool to build static blogs for your website. It converts your markdown files into html files and organizes them on the /blog path of your website. Perfect for developers who want to quickly set up a blog without relying on heavy frameworks or databases.
Features
- Markdown to HTML Conversion: Easily convert
.mdfiles into.htmlfiles. - Automatic Indexing: Generates a
posts.jsonfile to keep track of all your blog posts. - Simple CLI: Initialize and build your blog with just two commands.
- Customizable: Add your own styles and templates to the generated HTML files.
- No Dependencies: Just plain JavaScript and a few lightweight libraries.
Installation
SimpleBlogger is a command-line tool, so it should be installed globally. Run the following command to install it:
npm install -g simplebloggerUsage
1. Initialize Your Blog
Suppose your website is located in src folder, then go into that folder and Run the following command to set up the blog structure:
simpleblogger initThis will create the following folder structure:
blog/
├── index.html # Blog homepage
└── posts/
├── posts-md/ # Folder for Markdown files
├── posts-html/ # Folder for generated HTML files
└── posts.json # Metadata for all postsGetting an error? If you installed simpleblogger locally instead of installing it globally, you will get an error similar to command not found when using simpleblogger. To avoid that you need to using simpleblogger with npx like npx simpleblogger init .
2. Create a New Post
Use the create-post command to generate a new Markdown post template:
simpleblogger create-post "My First Post"This will create a file like blog/posts/posts-md/my-first-post.md with pre-filled front matter:
---
title: My First Post
date: 2023-10-01
---
# Welcome to My Blog
This is my first post!Do not change anything in between the --- & ---
3. Build Your Blog
Run the following command to convert Markdown files to HTML and update the posts.json file:
simpleblogger buildThis will:
- Convert all
.mdfiles inposts-md/to.htmlfiles inposts-html/. - Update
posts.jsonwith metadata (title, date, and file path). - It will also index your blog posts at
yourwebsite.com/blog
4. View Your Blog
Open the blog/index.html file in your browser to see your blog in action. You can deploy the blog/ folder to your website's /blog path.
Example
Folder Structure After Initialization
blog/
├── index.html
└── posts/
├── posts-md/
│ └── post1.md
├── posts-html/
│ └── post1.html
└── posts.jsonposts.json After Building
[
{
"id": 0,
"title": "My First Post",
"date": "2023-10-01",
"file": "post1.html"
}
]Customization
Styling Your Blog
You can customize the appearance of your blog by editing the blog/index.html file and adding your own CSS.
Feature Requests or Bugs
If you'd like a new feature or want to report a bug, open an issue or pull requests are most welcome.
Contributing
Read CONTRIBUTING.MD for more info.
License
SimpleBlogger is open-source software licensed under the MIT License.
Contact
I can be contacted through my email at hello@apoorvpathak.com
Support
If you find this tool useful, consider giving it a ⭐ on GitHub. For questions or issues, please open an issue on the repository.
Happy blogging! 🚀