fossbook 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +246 -246
- package/bin/fossbook.js +120 -120
- package/lib/all_posts.js +33 -32
- package/lib/assets/placeholder.svg +3 -3
- package/lib/deploy.js +257 -237
- package/lib/home.js +60 -59
- package/lib/index.js +79 -79
- package/lib/init.js +311 -265
- package/lib/mod/config.js +136 -136
- package/lib/mod/marked.js +95 -95
- package/lib/mod/page.js +119 -115
- package/lib/mod/page_base.js +97 -97
- package/lib/new.js +48 -48
- package/lib/posts.js +47 -42
- package/lib/server.js +20 -14
- package/lib/tag/index.js +70 -69
- package/lib/tag/tag.js +30 -29
- package/package.json +45 -45
- package/themes/archie/assets/fonts/fira-sans-v10-latin-regular.svg +330 -330
- package/themes/archie/assets/fonts/ibm-plex-mono-v6-latin-500italic.svg +365 -365
- package/themes/archie/assets/fonts/roboto-mono-v12-latin-regular.svg +405 -405
- package/themes/archie/assets/styles/fonts.css +51 -51
- package/themes/archie/assets/styles/highlights.css +75 -75
- package/themes/archie/assets/styles/main.css +402 -402
- package/themes/archie/layouts/all_posts.html +41 -41
- package/themes/archie/layouts/home.html +61 -61
- package/themes/archie/layouts/page.html +50 -50
- package/themes/archie/layouts/partials/footer.html +9 -9
- package/themes/archie/layouts/post.html +81 -81
- package/themes/archie/layouts/tag.html +42 -42
- package/themes/archie/layouts/tag_list.html +43 -43
package/README.md
CHANGED
|
@@ -1,246 +1,246 @@
|
|
|
1
|
-
# Fossbook
|
|
2
|
-
|
|
3
|
-
A lightweight static blog site generator for GitHub Pages, similar to Hugo but built with Node.js.
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
- **Markdown-based** — Write posts in Markdown with YAML front-matter
|
|
8
|
-
- **Pagination** — Automatic home page pagination
|
|
9
|
-
- **Tags** — Tag-based categorization with tag index and per-tag listing pages
|
|
10
|
-
- **Theming** — Bundled Archie theme with support for custom themes
|
|
11
|
-
- **SEO** — Open Graph and Twitter Card meta tags out of the box
|
|
12
|
-
- **GitHub Pages** — Built-in CNAME support for custom domains
|
|
13
|
-
- **Dev server** — Local preview server with Express
|
|
14
|
-
- **Syntax highlighting** — Code block highlighting via highlight.js
|
|
15
|
-
|
|
16
|
-
## Quick Start
|
|
17
|
-
|
|
18
|
-
### Install globally
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
npm install -g fossbook
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
### Create a new site
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
mkdir my-blog && cd my-blog
|
|
28
|
-
fossbook init
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
This creates the following structure:
|
|
32
|
-
|
|
33
|
-
```
|
|
34
|
-
my-blog/
|
|
35
|
-
├── content/
|
|
36
|
-
│ ├── about.md
|
|
37
|
-
│ └── posts/
|
|
38
|
-
├── static/
|
|
39
|
-
│ └── images/
|
|
40
|
-
├── fossbook.config.js
|
|
41
|
-
└── package.json
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
### Create a new post
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
fossbook new "My First Post"
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
This creates `content/posts/My First Post/index.md` with pre-filled front-matter and an `images/` directory.
|
|
51
|
-
|
|
52
|
-
### Build the site
|
|
53
|
-
|
|
54
|
-
```bash
|
|
55
|
-
fossbook build
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
### Preview locally
|
|
59
|
-
|
|
60
|
-
```bash
|
|
61
|
-
fossbook serve
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
Open http://localhost:3000 to view your site.
|
|
65
|
-
|
|
66
|
-
## Configuration
|
|
67
|
-
|
|
68
|
-
Create a `fossbook.config.js` in your project root:
|
|
69
|
-
|
|
70
|
-
```js
|
|
71
|
-
module.exports = {
|
|
72
|
-
blogName: "My Blog",
|
|
73
|
-
authorName: "Your Name",
|
|
74
|
-
authorDescription: "A short bio",
|
|
75
|
-
authorWebsite: "https://example.com",
|
|
76
|
-
blogDescription: "A blog about things",
|
|
77
|
-
blogsite: "https://example.com",
|
|
78
|
-
|
|
79
|
-
// Optional
|
|
80
|
-
githubCNAME: "example.com",
|
|
81
|
-
googleAnalyticsID: "",
|
|
82
|
-
authorTwitter: "@you",
|
|
83
|
-
siteTwitter: "@yourblog",
|
|
84
|
-
githubRepository: "https://github.com/you/your-blog",
|
|
85
|
-
image: "https://example.com/default-image.png",
|
|
86
|
-
theme: "archie",
|
|
87
|
-
|
|
88
|
-
// Directory overrides (defaults shown)
|
|
89
|
-
content: "./content",
|
|
90
|
-
postsDir: "./content/posts",
|
|
91
|
-
outputDir: "./public",
|
|
92
|
-
staticDir: "./static",
|
|
93
|
-
themesDir: "./themes",
|
|
94
|
-
};
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
## Content Format
|
|
98
|
-
|
|
99
|
-
### Post front-matter
|
|
100
|
-
|
|
101
|
-
```markdown
|
|
102
|
-
---
|
|
103
|
-
title: My Post Title
|
|
104
|
-
date: 2026-02-17
|
|
105
|
-
description: "A brief summary of the post"
|
|
106
|
-
image: "feature.png"
|
|
107
|
-
tags: "JavaScript, Node.js, Static Site"
|
|
108
|
-
---
|
|
109
|
-
|
|
110
|
-
Your Markdown content here...
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
### Directory structure
|
|
114
|
-
|
|
115
|
-
```
|
|
116
|
-
content/posts/My Post Title/
|
|
117
|
-
├── index.md
|
|
118
|
-
└── images/
|
|
119
|
-
└── feature.png
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
## CLI Reference
|
|
123
|
-
|
|
124
|
-
```
|
|
125
|
-
Usage: fossbook <command> [options]
|
|
126
|
-
|
|
127
|
-
Commands:
|
|
128
|
-
build Build the static site
|
|
129
|
-
serve Build and start a local dev server
|
|
130
|
-
new <title> Create a new post
|
|
131
|
-
init Create a new fossbook site project
|
|
132
|
-
|
|
133
|
-
Options:
|
|
134
|
-
-c, --config Path to config file (default: ./fossbook.config.js)
|
|
135
|
-
-o, --output Output directory (default: ./public)
|
|
136
|
-
-p, --port Dev server port (default: 3000)
|
|
137
|
-
-v, --version Show version number
|
|
138
|
-
-h, --help Show help
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
## Theming
|
|
142
|
-
|
|
143
|
-
Fossbook ships with the Archie theme by default. To use a custom theme:
|
|
144
|
-
|
|
145
|
-
1. Create a `themes/<your-theme>/` directory in your project
|
|
146
|
-
2. Add `layouts/` (HTML templates) and `assets/` (CSS, fonts, images)
|
|
147
|
-
3. Set `theme: "your-theme"` in `fossbook.config.js`
|
|
148
|
-
|
|
149
|
-
Theme resolution order: user project `themes/` → built-in `themes/`.
|
|
150
|
-
|
|
151
|
-
### Required layout files
|
|
152
|
-
|
|
153
|
-
```
|
|
154
|
-
layouts/
|
|
155
|
-
├── home.html # Home page with pagination
|
|
156
|
-
├── post.html # Individual post page
|
|
157
|
-
├── page.html # Static pages (e.g., about)
|
|
158
|
-
├── all_posts.html # All posts listing
|
|
159
|
-
├── tag.html # Per-tag listing
|
|
160
|
-
├── tag_list.html # Tag index page
|
|
161
|
-
└── partials/
|
|
162
|
-
└── footer.html # Footer partial
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
## Deploying to GitHub Pages
|
|
166
|
-
|
|
167
|
-
Fossbook can automatically deploy your blog to GitHub Pages using GitHub Actions.
|
|
168
|
-
|
|
169
|
-
### Prerequisites: Install GitHub CLI (`gh`)
|
|
170
|
-
|
|
171
|
-
The `fossbook deploy` command uses the GitHub CLI to create repositories and monitor deployments.
|
|
172
|
-
|
|
173
|
-
**Linux (Debian/Ubuntu):**
|
|
174
|
-
|
|
175
|
-
```bash
|
|
176
|
-
sudo apt install gh
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
**macOS:**
|
|
180
|
-
|
|
181
|
-
```bash
|
|
182
|
-
brew install gh
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
**Windows:**
|
|
186
|
-
|
|
187
|
-
```bash
|
|
188
|
-
winget install GitHub.cli
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
Then authenticate with your GitHub account:
|
|
192
|
-
|
|
193
|
-
```bash
|
|
194
|
-
gh auth login
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
Follow the prompts to log in via browser or token.
|
|
198
|
-
|
|
199
|
-
### Initialize with GitHub
|
|
200
|
-
|
|
201
|
-
```bash
|
|
202
|
-
mkdir my-blog && cd my-blog
|
|
203
|
-
fossbook init --github
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
This will:
|
|
207
|
-
1. Scaffold the site project (config, content directories)
|
|
208
|
-
2. Create a GitHub repository for your blog
|
|
209
|
-
3. Generate `.github/workflows/deploy.yml` for automatic deployments
|
|
210
|
-
4. Push the initial commit to GitHub
|
|
211
|
-
|
|
212
|
-
### Publish a post
|
|
213
|
-
|
|
214
|
-
```bash
|
|
215
|
-
fossbook new "My New Article"
|
|
216
|
-
# ... edit content/posts/My New Article/index.md ...
|
|
217
|
-
fossbook deploy
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
Fossbook will build the site, commit, push to GitHub, wait for the CI/CD pipeline to finish, and display the live URL:
|
|
221
|
-
|
|
222
|
-
```
|
|
223
|
-
Building site... done.
|
|
224
|
-
Committing: "Publish: My New Article"
|
|
225
|
-
Pushing to origin/main...
|
|
226
|
-
Waiting for GitHub Pages deployment... ✓
|
|
227
|
-
|
|
228
|
-
✅ Published! View your article at:
|
|
229
|
-
https://username.github.io/my-blog/My%20New%20Article/
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
**Deploy options:**
|
|
233
|
-
|
|
234
|
-
```bash
|
|
235
|
-
fossbook deploy --message "Update homepage" # Custom commit message
|
|
236
|
-
fossbook deploy --no-wait # Push without waiting for CI
|
|
237
|
-
```
|
|
238
|
-
|
|
239
|
-
## License
|
|
240
|
-
|
|
241
|
-
- Generator code: [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause)
|
|
242
|
-
- Archie theme: [MIT License](https://github.com/athul/archie?tab=MIT-1-ov-file#readme)
|
|
243
|
-
|
|
244
|
-
## Credits
|
|
245
|
-
|
|
246
|
-
Adapted from [kartiknair's blog](https://github.com/kartiknair/blog) and styled using the [Archie theme](https://github.com/athul/archie).
|
|
1
|
+
# Fossbook
|
|
2
|
+
|
|
3
|
+
A lightweight static blog site generator for GitHub Pages, similar to Hugo but built with Node.js.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Markdown-based** — Write posts in Markdown with YAML front-matter
|
|
8
|
+
- **Pagination** — Automatic home page pagination
|
|
9
|
+
- **Tags** — Tag-based categorization with tag index and per-tag listing pages
|
|
10
|
+
- **Theming** — Bundled Archie theme with support for custom themes
|
|
11
|
+
- **SEO** — Open Graph and Twitter Card meta tags out of the box
|
|
12
|
+
- **GitHub Pages** — Built-in CNAME support for custom domains
|
|
13
|
+
- **Dev server** — Local preview server with Express
|
|
14
|
+
- **Syntax highlighting** — Code block highlighting via highlight.js
|
|
15
|
+
|
|
16
|
+
## Quick Start
|
|
17
|
+
|
|
18
|
+
### Install globally
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install -g fossbook
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Create a new site
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
mkdir my-blog && cd my-blog
|
|
28
|
+
fossbook init
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
This creates the following structure:
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
my-blog/
|
|
35
|
+
├── content/
|
|
36
|
+
│ ├── about.md
|
|
37
|
+
│ └── posts/
|
|
38
|
+
├── static/
|
|
39
|
+
│ └── images/
|
|
40
|
+
├── fossbook.config.js
|
|
41
|
+
└── package.json
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Create a new post
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
fossbook new "My First Post"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
This creates `content/posts/My First Post/index.md` with pre-filled front-matter and an `images/` directory.
|
|
51
|
+
|
|
52
|
+
### Build the site
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
fossbook build
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Preview locally
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
fossbook serve
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Open http://localhost:3000 to view your site.
|
|
65
|
+
|
|
66
|
+
## Configuration
|
|
67
|
+
|
|
68
|
+
Create a `fossbook.config.js` in your project root:
|
|
69
|
+
|
|
70
|
+
```js
|
|
71
|
+
module.exports = {
|
|
72
|
+
blogName: "My Blog",
|
|
73
|
+
authorName: "Your Name",
|
|
74
|
+
authorDescription: "A short bio",
|
|
75
|
+
authorWebsite: "https://example.com",
|
|
76
|
+
blogDescription: "A blog about things",
|
|
77
|
+
blogsite: "https://example.com",
|
|
78
|
+
|
|
79
|
+
// Optional
|
|
80
|
+
githubCNAME: "example.com",
|
|
81
|
+
googleAnalyticsID: "",
|
|
82
|
+
authorTwitter: "@you",
|
|
83
|
+
siteTwitter: "@yourblog",
|
|
84
|
+
githubRepository: "https://github.com/you/your-blog",
|
|
85
|
+
image: "https://example.com/default-image.png",
|
|
86
|
+
theme: "archie",
|
|
87
|
+
|
|
88
|
+
// Directory overrides (defaults shown)
|
|
89
|
+
content: "./content",
|
|
90
|
+
postsDir: "./content/posts",
|
|
91
|
+
outputDir: "./public",
|
|
92
|
+
staticDir: "./static",
|
|
93
|
+
themesDir: "./themes",
|
|
94
|
+
};
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Content Format
|
|
98
|
+
|
|
99
|
+
### Post front-matter
|
|
100
|
+
|
|
101
|
+
```markdown
|
|
102
|
+
---
|
|
103
|
+
title: My Post Title
|
|
104
|
+
date: 2026-02-17
|
|
105
|
+
description: "A brief summary of the post"
|
|
106
|
+
image: "feature.png"
|
|
107
|
+
tags: "JavaScript, Node.js, Static Site"
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
Your Markdown content here...
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Directory structure
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
content/posts/My Post Title/
|
|
117
|
+
├── index.md
|
|
118
|
+
└── images/
|
|
119
|
+
└── feature.png
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## CLI Reference
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
Usage: fossbook <command> [options]
|
|
126
|
+
|
|
127
|
+
Commands:
|
|
128
|
+
build Build the static site
|
|
129
|
+
serve Build and start a local dev server
|
|
130
|
+
new <title> Create a new post
|
|
131
|
+
init Create a new fossbook site project
|
|
132
|
+
|
|
133
|
+
Options:
|
|
134
|
+
-c, --config Path to config file (default: ./fossbook.config.js)
|
|
135
|
+
-o, --output Output directory (default: ./public)
|
|
136
|
+
-p, --port Dev server port (default: 3000)
|
|
137
|
+
-v, --version Show version number
|
|
138
|
+
-h, --help Show help
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Theming
|
|
142
|
+
|
|
143
|
+
Fossbook ships with the Archie theme by default. To use a custom theme:
|
|
144
|
+
|
|
145
|
+
1. Create a `themes/<your-theme>/` directory in your project
|
|
146
|
+
2. Add `layouts/` (HTML templates) and `assets/` (CSS, fonts, images)
|
|
147
|
+
3. Set `theme: "your-theme"` in `fossbook.config.js`
|
|
148
|
+
|
|
149
|
+
Theme resolution order: user project `themes/` → built-in `themes/`.
|
|
150
|
+
|
|
151
|
+
### Required layout files
|
|
152
|
+
|
|
153
|
+
```
|
|
154
|
+
layouts/
|
|
155
|
+
├── home.html # Home page with pagination
|
|
156
|
+
├── post.html # Individual post page
|
|
157
|
+
├── page.html # Static pages (e.g., about)
|
|
158
|
+
├── all_posts.html # All posts listing
|
|
159
|
+
├── tag.html # Per-tag listing
|
|
160
|
+
├── tag_list.html # Tag index page
|
|
161
|
+
└── partials/
|
|
162
|
+
└── footer.html # Footer partial
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Deploying to GitHub Pages
|
|
166
|
+
|
|
167
|
+
Fossbook can automatically deploy your blog to GitHub Pages using GitHub Actions.
|
|
168
|
+
|
|
169
|
+
### Prerequisites: Install GitHub CLI (`gh`)
|
|
170
|
+
|
|
171
|
+
The `fossbook deploy` command uses the GitHub CLI to create repositories and monitor deployments.
|
|
172
|
+
|
|
173
|
+
**Linux (Debian/Ubuntu):**
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
sudo apt install gh
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
**macOS:**
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
brew install gh
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
**Windows:**
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
winget install GitHub.cli
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Then authenticate with your GitHub account:
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
gh auth login
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Follow the prompts to log in via browser or token.
|
|
198
|
+
|
|
199
|
+
### Initialize with GitHub
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
mkdir my-blog && cd my-blog
|
|
203
|
+
fossbook init --github
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
This will:
|
|
207
|
+
1. Scaffold the site project (config, content directories)
|
|
208
|
+
2. Create a GitHub repository for your blog
|
|
209
|
+
3. Generate `.github/workflows/deploy.yml` for automatic deployments
|
|
210
|
+
4. Push the initial commit to GitHub
|
|
211
|
+
|
|
212
|
+
### Publish a post
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
fossbook new "My New Article"
|
|
216
|
+
# ... edit content/posts/My New Article/index.md ...
|
|
217
|
+
fossbook deploy
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
Fossbook will build the site, commit, push to GitHub, wait for the CI/CD pipeline to finish, and display the live URL:
|
|
221
|
+
|
|
222
|
+
```
|
|
223
|
+
Building site... done.
|
|
224
|
+
Committing: "Publish: My New Article"
|
|
225
|
+
Pushing to origin/main...
|
|
226
|
+
Waiting for GitHub Pages deployment... ✓
|
|
227
|
+
|
|
228
|
+
✅ Published! View your article at:
|
|
229
|
+
https://username.github.io/my-blog/My%20New%20Article/
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
**Deploy options:**
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
fossbook deploy --message "Update homepage" # Custom commit message
|
|
236
|
+
fossbook deploy --no-wait # Push without waiting for CI
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
## License
|
|
240
|
+
|
|
241
|
+
- Generator code: [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause)
|
|
242
|
+
- Archie theme: [MIT License](https://github.com/athul/archie?tab=MIT-1-ov-file#readme)
|
|
243
|
+
|
|
244
|
+
## Credits
|
|
245
|
+
|
|
246
|
+
Adapted from [kartiknair's blog](https://github.com/kartiknair/blog) and styled using the [Archie theme](https://github.com/athul/archie).
|