Don't break the chain! ⛓️ ✍️
JAMBook is a project for people who want to use GitHub as their primary writing environment. All articles are written as basic markdown files and there is a calendar to help you not break the chain of your daily writing goal. It's deployable to Netlify and the word count function runs as a GitHub action so there is nothing for you to install or run locally.
- Click “Use this template” at the top of this page and name your copy whatever you want.
- Login into Netlify and click “New site from Git” and select the repo you just created.
- Start created and editing your .md files in the
src/posts
folder - Every time you commit your changes, the work count script will run and the updated site will be redeployed to Netlify
You can also run this project locally if you prefer. After cloning the code to your local, go to the path, and install the dependencies:
cd <path-of-project>
npm install # or yarn install
In case you want to look at the project locally first, you can run the project in development mode:
npm run dev # or yarn dev
This will start the development server on localhost:3000.
To be able to look at additions and subtraction for your blog posts, you need to put the blog post files into the src/posts
folder. By default, you will only find a example-post.md
file in the folder.
Whenever you are done with updates to your blog posts located in the src/posts
folder, make sure to commit and push the changes. This will run the wordCount.js
script for you automatically in the background and the latest additions and subtractions will be calculated.
If you want to be able to view your blog posts directly in the browser, you can find them under the /blog
url or through clicking the "Blog" navigation item in the UI.
To connect the blog post articles correctly, you have to add frontmatter metadata to each of them like shown in the example post:
---
title: 'Example post'
slug: 'example-post'
---
This will make your blog post available under a unique url based on the slug like: /blog/example-post
.
The default daily word count and document length goals are set to 200 and 1000 by default but can be adjusted on the metrics page. After adjustment, they will be saved in a cookie.
The word count script is calculated as a pre-commit if writing locally (this results in a single Netlify build)
If the word count script is run by the GitHub action when writing through the browser (this results in a double-build on Netlify)
The single source of truth for the word count changes which are displayed on the UI is the logfile.json
.