@zeropress/build-pages 0.5.6 → 0.6.2

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 CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Build ZeroPress static output for modern hosting platforms.
7
7
 
8
- `@zeropress/build-pages` turns a directory of Markdown files and public assets into a static ZeroPress site. It discovers Markdown pages, prepares the site data, stages public files, and runs [`@zeropress/build`](https://github.com/zeropress-app/zeropress-build).
8
+ `@zeropress/build-pages` turns Markdown files and public assets into a static ZeroPress site. It discovers Markdown pages, prepares the site data, stages public files, and runs [`@zeropress/build`](https://github.com/zeropress-app/zeropress-build).
9
9
 
10
10
  The generated output is plain static files that can be deployed to GitHub Pages, Cloudflare Pages, Netlify, Vercel, or any static hosting provider.
11
11
 
@@ -13,7 +13,9 @@ The generated output is plain static files that can be deployed to GitHub Pages,
13
13
 
14
14
  ```txt
15
15
  source directory
16
- Markdown pages + .zeropress/config.json + public files
16
+ Markdown pages + .zeropress/config.json
17
+ public directory
18
+ public files (defaults to source)
17
19
  |
18
20
  v
19
21
  @zeropress/build-pages
@@ -32,7 +34,7 @@ static output directory
32
34
  flowchart TD
33
35
  source["Source directory"] --> markdown["Markdown pages (*.md)"]
34
36
  source --> config[".zeropress/config.json"]
35
- source --> publicFiles["Public files<br/>images, CSS, JS, PDF, JSON, Markdown"]
37
+ publicRoot["Public directory<br/>defaults to source"] --> publicFiles["Public files<br/>images, CSS, JS, PDF, JSON, Markdown"]
36
38
 
37
39
  markdown --> buildPages["@zeropress/build-pages"]
38
40
  config --> buildPages
@@ -82,7 +84,8 @@ jobs:
82
84
  - name: Build ZeroPress Pages
83
85
  uses: zeropress-app/zeropress-build-pages@v0
84
86
  with:
85
- source: ./documents
87
+ source: ./docs
88
+ public-dir: ./public
86
89
  destination: ./_site
87
90
  - name: Upload artifact
88
91
  uses: actions/upload-pages-artifact@v5
@@ -114,6 +117,7 @@ That is equivalent to:
114
117
  uses: zeropress-app/zeropress-build-pages@v0
115
118
  with:
116
119
  source: ./docs
120
+ public-dir: ./docs
117
121
  destination: ./_site
118
122
  theme: docs
119
123
  skip-untitled-markdown: false
@@ -128,6 +132,7 @@ Custom input example:
128
132
  uses: zeropress-app/zeropress-build-pages@v0
129
133
  with:
130
134
  source: ./documents
135
+ public-dir: ./public
131
136
  destination: ./_site
132
137
  theme-path: ./theme-docs
133
138
  config: ./documents/.zeropress/config.json
@@ -137,18 +142,33 @@ Custom input example:
137
142
 
138
143
  In the action inputs:
139
144
 
140
- - `source` is the directory that contains your Markdown pages, public files, and optional `.zeropress/config.json`. The default is `./docs`.
145
+ - `source` is the directory that contains your Markdown pages and optional `.zeropress/config.json`. The default is `./docs`.
146
+ - `public-dir` is the directory copied as public passthrough files. The default is `source`.
141
147
  - `destination` is the directory where the generated static site is written. The default is `./_site`.
142
148
  - `theme` is the bundled theme name. The default is `docs`.
143
149
  - `theme-path` is a custom local ZeroPress theme directory. It takes precedence over `theme`.
144
150
  - `config` is the config file path. The default is `<source>/.zeropress/config.json`.
145
151
  - `site-url` overrides the canonical site URL from config.
146
152
  - `skip-untitled-markdown` skips Markdown files without a page title instead of failing. The default is `false`.
147
- - `skip-link-check` skips internal link checking after build. The default is `false`.
153
+ - `skip-link-check` skips internal link checking after build. The default is `false`; broken internal links are reported as warnings and do not fail the build.
148
154
  - `copy-markdown-source` copies original Markdown files to the generated output and enables `View this page as Markdown` links in the bundled docs theme. The default is `true`.
149
155
 
150
156
  For GitHub Pages, the generated `destination` directory can be passed to `actions/upload-pages-artifact`. For Cloudflare Pages, Netlify, Vercel, or another static host, pass the same `destination` directory to that provider's deploy step.
151
157
 
158
+ Need a custom theme? Start with [`@zeropress/create-theme`](https://www.npmjs.com/package/@zeropress/create-theme), then point `theme-path` to the generated `theme/` directory:
159
+
160
+ ```bash
161
+ npx @zeropress/create-theme --name my-docs-theme --template docs
162
+ ```
163
+
164
+ ```yaml
165
+ with:
166
+ source: ./docs
167
+ public-dir: ./public
168
+ destination: ./_site
169
+ theme-path: ./my-docs-theme/theme
170
+ ```
171
+
152
172
  ### npx
153
173
 
154
174
  Use `npx` when you want to run Build Pages without adding it to your project dependencies.
@@ -183,19 +203,20 @@ The CLI requires explicit input and output paths. The GitHub Action keeps safe d
183
203
 
184
204
  | Option | Default | Purpose |
185
205
  | --- | --- | --- |
186
- | `--source <dir>` | required | Dedicated source directory containing Markdown and public files |
206
+ | `--source <dir>` | required | Dedicated source directory containing Markdown and optional config |
207
+ | `--public-dir <dir>` | source | Public passthrough directory |
187
208
  | `--destination <dir>` | required | Output directory |
188
209
  | `--theme docs` | `docs` | Bundled docs theme |
189
210
  | `--theme-path <dir>` | none | Custom ZeroPress theme directory |
190
211
  | `--config <path>` | `<source>/.zeropress/config.json` | Build Pages config |
191
212
  | `--site-url <url>` | config `site.url` | Canonical URL override |
192
213
  | `--skip-untitled-markdown` | `false` | Skip Markdown without a page title |
193
- | `--skip-link-check` | `false` | Skip link checking |
214
+ | `--skip-link-check` | `false` | Skip warning-only internal link checking |
194
215
  | `--no-copy-markdown-source` | `false` | Do not copy original Markdown files to output |
195
216
 
196
217
  ## Source Tree
197
218
 
198
- The source directory is the folder that Build Pages reads. It is both the Markdown source root and the public passthrough root. GitHub Action usage defaults to `./docs`; CLI usage requires `--source`.
219
+ The source directory is the folder that Build Pages reads for Markdown pages and optional `.zeropress/config.json`. By default, the source directory is also the public passthrough root. Use `public-dir` when you want to keep Markdown source and public assets separate.
199
220
 
200
221
  Use a dedicated content directory such as `docs/` or `documents/`. Repository root source (`--source ./`) is not supported.
201
222
 
@@ -204,18 +225,25 @@ my-site/
204
225
  docs/ # source
205
226
  index.md
206
227
  guide.md
207
- assets/
208
- logo.png
209
228
  .zeropress/
210
229
  config.json
230
+ public/ # public-dir, optional
231
+ assets/
232
+ logo.png
233
+ favicon.svg
234
+ robots.txt
211
235
  _site/ # destination, generated
212
236
  ```
213
237
 
214
- Build Pages stages the source tree before calling [`@zeropress/build`](https://github.com/zeropress-app/zeropress-build). Generated ZeroPress output wins over staged public files.
238
+ Build Pages stages the public directory before calling [`@zeropress/build`](https://github.com/zeropress-app/zeropress-build). Generated ZeroPress output wins over staged public files.
215
239
 
216
- Root-level source favicon files named `favicon.ico`, `favicon.svg`, `favicon.png`, and `apple-touch-icon.png` are copied to the destination and auto-injected into generated HTML `<head>` output.
240
+ Root-level public files named `favicon.ico`, `favicon.svg`, `favicon.png`, and `apple-touch-icon.png` are copied to the destination and auto-injected into generated HTML `<head>` output.
217
241
 
218
- The source directory must not overlap the destination directory, the selected theme directory, or the internal `.zeropress/` working directory.
242
+ A root-level public `sitemap.xsl` is copied to the destination. When ZeroPress generates `sitemap.xml`, it auto-discovers that file and adds an XML stylesheet processing instruction for `/sitemap.xsl`.
243
+
244
+ The source directory must not overlap the destination directory, the selected theme directory, or the internal `.zeropress/` working directory. An explicit public directory must be an existing dedicated directory and must not be a file, symlink, repository root, destination directory, selected theme directory, or internal `.zeropress/` working directory.
245
+
246
+ If `public-dir` is inside `source`, Build Pages excludes that public subtree from Markdown page discovery.
219
247
 
220
248
  Ignored while staging and Markdown discovery:
221
249
 
@@ -254,8 +282,16 @@ title: Install ZeroPress
254
282
  description: Build a static docs site from Markdown.
255
283
  path: guides/install
256
284
  status: published
285
+ discoverability: default
257
286
  meta:
258
287
  source: docs
288
+ data:
289
+ stack:
290
+ - ZeroPress
291
+ - Cloudflare
292
+ facts:
293
+ - label: Role
294
+ value: Documentation
259
295
  ---
260
296
 
261
297
  Body content...
@@ -271,10 +307,31 @@ Supported front matter fields:
271
307
  | `description` | Page excerpt and description. |
272
308
  | `path` | Generated route path, such as `guides/install` for `/guides/install`. |
273
309
  | `status` | `published` includes the page. `draft` skips the page. Other values warn and skip. |
310
+ | `discoverability` | `default`, `noindex`, or `delist`. Missing is `default`. |
274
311
  | `meta` | Optional scalar/null metadata copied to the generated page. |
312
+ | `data` | Optional structured JSON-style data for theme-facing lists, facts, galleries, timelines, or swatches. |
275
313
 
276
314
  Unknown front matter fields are ignored to make migration from existing Markdown sites easier.
277
315
 
316
+ `status` controls route generation. `status: draft` removes the Markdown file from generated preview-data and no HTML route is created.
317
+
318
+ `discoverability` controls automatic exposure after a route is generated:
319
+
320
+ - `default`: no special handling.
321
+ - `noindex`: generate the page and add HTML robots `noindex`.
322
+ - `delist`: generate the page, add HTML robots `noindex`, and exclude it from automatic discovery outputs such as sitemap, native search, and generated post/page listing data.
323
+
324
+ `delist` is not a security or permission feature. Direct links, explicit menus, explicit collections, and body links can still expose the page.
325
+
326
+ Use `meta` for small scalar flags and metadata. Use `data` when a theme should iterate structured content:
327
+
328
+ ```html
329
+ {{#for fact in page.data.facts}}
330
+ <dt>{{fact.label}}</dt>
331
+ <dd>{{fact.value}}</dd>
332
+ {{/for}}
333
+ ```
334
+
278
335
  ## Config
279
336
 
280
337
  Build Pages reads `<source>/.zeropress/config.json` when present. Missing config falls back to defaults.
@@ -289,12 +346,12 @@ See the public config reference at [zeropress.dev/build-pages-config](https://ze
289
346
  "title": "My Docs",
290
347
  "description": "Project documentation",
291
348
  "url": "https://example.github.io/project",
349
+ "expose_generator": true,
350
+ "search": true,
292
351
  "indexing": true,
293
352
  "footer": {
294
353
  "copyright_text": "Copyright 2026 Example Corp.",
295
- "attribution": {
296
- "enabled": true
297
- }
354
+ "attribution": true
298
355
  }
299
356
  },
300
357
  "front_page": {
@@ -305,7 +362,14 @@ See the public config reference at [zeropress.dev/build-pages-config](https://ze
305
362
  "name": "Primary Menu",
306
363
  "items": [
307
364
  { "title": "Home", "url": "/" },
308
- { "title": "Guide", "url": "/guide" }
365
+ {
366
+ "title": "Guide",
367
+ "url": "/guide",
368
+ "meta": {
369
+ "icon": "book-open",
370
+ "badge": "New"
371
+ }
372
+ }
309
373
  ]
310
374
  }
311
375
  },
@@ -325,19 +389,36 @@ See the public config reference at [zeropress.dev/build-pages-config](https://ze
325
389
 
326
390
  HTML front page and `custom_html` files must stay inside `.zeropress/`.
327
391
 
392
+ Menu item `meta` is optional scalar display metadata copied into generated preview-data for themes that manually iterate menus. Use it for small values such as `icon`, `badge`, or `accent`; arrays and objects are not accepted.
393
+
328
394
  `site.footer.copyright_text` is rendered by the bundled docs theme when present. If it is omitted, the bundled docs theme falls back to `site.title`. ZeroPress does not add a copyright symbol automatically.
329
395
 
330
- The bundled docs theme shows `Published with ZeroPress.` by default. Set `site.footer.attribution.enabled` to `false` to hide it.
396
+ The bundled docs theme shows `Published with ZeroPress.` by default. Set `site.footer.attribution` to `false` to hide it.
397
+
398
+ `site.expose_generator` controls the HTML generator meta tag. Missing or `true` emits `<meta name="generator" content="ZeroPress">`; set it to `false` for white-label sites.
399
+
400
+ `site.search` controls native ZeroPress search when the selected theme supports search UI. Missing or `true` enables native search for the bundled docs theme; `false` omits `/_zeropress/search.json`, `/_zeropress/search.js`, and `/_zeropress/search_pagefind.js` and hides the bundled search form.
401
+
402
+ The bundled docs theme marks post/page body content with `data-pagefind-body`. If you run Pagefind after the ZeroPress build, keep the theme UI pointed at `/_zeropress/search.js` and replace the native adapter:
403
+
404
+ ```bash
405
+ npx pagefind@latest \
406
+ --site ./_site \
407
+ --output-subdir _zeropress/pagefind
408
+
409
+ cp ./_site/_zeropress/search_pagefind.js ./_site/_zeropress/search.js
410
+ rm ./_site/_zeropress/search.json
411
+ ```
331
412
 
332
- `site.indexing` controls only the generated fallback `robots.txt`. Missing or `true` allows indexing; `false` writes `User-agent: *` / `Disallow: /`. If the source directory contains `robots.txt`, that file is copied as-is and takes priority over `site.indexing`. ZeroPress does not append a `Sitemap` directive to a source-provided `robots.txt`; add `Sitemap: https://example.com/sitemap.xml` manually when needed.
413
+ `site.indexing` controls only the generated fallback `robots.txt`. Missing or `true` allows indexing; `false` writes `User-agent: *` / `Disallow: /`. If the public directory contains `robots.txt`, that file is copied as-is and takes priority over `site.indexing`. ZeroPress does not append a `Sitemap` directive to a public `robots.txt`; add `Sitemap: https://example.com/sitemap.xml` manually when needed.
333
414
 
334
415
  Schemas:
335
416
 
336
417
  - [ZeroPress Build Pages Config v0.1](https://zeropress.dev/schemas/zeropress-build-pages.config.v0.1.schema.json)
337
418
 
338
- ## Internal `.zeropress/` Files
419
+ ## Workspace Internal `.zeropress/` Files
339
420
 
340
- Build Pages writes internal working files to `.zeropress/` in the current working directory. These files are not the final deploy output. The final static site is written to the `destination` directory.
421
+ Build Pages reads optional site config from `<source>/.zeropress/config.json`. Separately, it writes internal working files to `.zeropress/` in the current working directory. These generated working files are not the final deploy output. The final static site is written to the `destination` directory.
341
422
 
342
423
  ```txt
343
424
  .zeropress/
@@ -351,13 +432,13 @@ Build Pages writes internal working files to `.zeropress/` in the current workin
351
432
 
352
433
  `preview-data.json` is an internal generated build input for the ZeroPress renderer. Most users do not need to edit or understand this file.
353
434
 
354
- `build-report.json` records discovered Markdown counts, skipped Markdown files, front page resolution, source Markdown copy policy, and custom HTML slots.
435
+ `build-report.json` records source/public roots, discovered Markdown counts, skipped Markdown files, front page resolution, source Markdown copy policy, and custom HTML slots.
355
436
 
356
437
  `public-assets/` is a temporary staged public root used before the final ZeroPress render.
357
438
 
358
439
  ## Destination Output
359
440
 
360
- The `destination` directory contains the deployable static site. It includes generated ZeroPress HTML, copied public files, and original Markdown files unless Markdown source copy is disabled or files are excluded by the public passthrough rules. A source `robots.txt` is copied as a site-owned policy file; otherwise ZeroPress writes a fallback `robots.txt` with a sitemap directive when `site.url` is available. Root-level source favicon files are copied and represented as generated HTML head links.
441
+ The `destination` directory contains the deployable static site. It includes generated ZeroPress HTML, copied public files, and original Markdown files unless Markdown source copy is disabled or files are excluded by the public passthrough rules. A public `robots.txt` is copied as a site-owned policy file; otherwise ZeroPress writes a fallback `robots.txt` with a sitemap directive when `site.url` is available. Root-level public favicon files are copied and represented as generated HTML head links. A root-level public `sitemap.xsl` is copied and linked from generated `sitemap.xml`.
361
442
 
362
443
  ## Demo
363
444
 
package/action.yml CHANGED
@@ -9,6 +9,9 @@ inputs:
9
9
  description: Dedicated source directory containing Markdown files and optional .zeropress/config.json. Repository root source is not supported.
10
10
  required: false
11
11
  default: ./docs
12
+ public-dir:
13
+ description: Public passthrough directory for site-owned assets. Defaults to source.
14
+ required: false
12
15
  destination:
13
16
  description: Output directory for the generated static site.
14
17
  required: false