weblog.js
is a minimal blogging using Node.js. Using Marked.js and gray-matter.
See the blog post for more details.
- Clone this repository and install dependencies
https://github.com/w3teal/weblog.js.git cd weblog.js npm install
- Build the website
npm start
Instead of using the default content
and _site
directory, you can configure it in const inputDir
/outputDir
in weblog.config.json. (In the output folder, you can also use that directory as asset storage)
You can create your own custom layout by changing on the function buildHTML
part in weblog.js.
You can use the default title
, date
, and description
data as frontmatter and reusable in layout. You can also add another data as you want, for example:
---
title: More data
+ ifykyk: Apple
---
You can use the ifykyk
data as ${ifykyk}
in layout.
You can add ${_listing}
to post you want. e.g. _content/_index.md
, the listing will be shown at that page (index.html
).
If you just want to add listing to adjusted latest posts, you can use e.g. ${_listing latest 2}
. File example
- Go to the output directory and init
cd _site git init
- Publish the repository with your desired client, like i use GitHub Desktop.
- Deploy
- You can deploy it in GitHub Pages, but it will broke in url like
USERNAME.github.io/BLOG
. If you want to deploy it in GitHub Pages, you should name the repository asUSERNAME.github.io
, or use your own custom domain for that repo. - For easier deploy, i recommend you to use Vercel. Just go to your Vercel dashboard, Click "Add New" > "Project" and click "Import" to the repo.
- You can deploy it in GitHub Pages, but it will broke in url like
You can see the result in my _site repo.
This project is not actively developed, and most updates are here for my blog at w3teal.is-a.dev. Use this project at your own risk, updates are not guaranteed! (But if you don't expect that, and just want to use a light and stable SSG, this might be for you).