|
1 | 1 | --- |
2 | 2 | title: uib-markweb - Dynamic web sites using Markdown |
3 | | -description: > |
| 3 | +description: | |
4 | 4 | The `uib-markweb` node allows you to create dynamic web sites using Markdown files. |
5 | 5 | created: 2026-01-09 15:10:14 |
6 | | -updated: 2026-02-02 16:10:39 |
| 6 | +updated: 2026-02-02 20:13:30 |
7 | 7 | status: Release |
8 | 8 | since: v7.6.0 |
9 | 9 | --- |
@@ -36,29 +36,67 @@ While these are initially processed server-side so that only HTML is passed over |
36 | 36 |
|
37 | 37 | These provide more complex processing than simple variable replacement. They are enclosed in `%%...%%` tags. Attributes are generally optional and are specified inside square brackets `[...]` as comma-separated `attribute=value` pairs. |
38 | 38 |
|
39 | | -* `%%nav [attributes]%%` - Generates a navigation menu based on the folder structure. Attributes can be used to control depth, type (files/folders/both), orientation (horizontal/vertical), etc. |
| 39 | +#### Navigation menu (`%%nav%%`) |
40 | 40 |
|
41 | | - `nav` uses the `%%index%%` directive internally to build the menu structure. So it accepts the same attributes as `index`, plus: |
| 41 | +`%%nav [attributes]%%` - Generates a navigation menu based on the folder structure. Attributes can be used to control depth, type (files/folders/both), orientation (horizontal/vertical), etc. |
42 | 42 |
|
43 | | - * `orient` - The orientation of the menu: `horizontal` ~~or `vertical`~~ (default: `horizontal`). As of v7.6.0, only `horizontal` is implemented. You can use `%%index%%` to build vertical lists. |
| 43 | +`nav` uses the `%%index%%` directive internally to build the menu structure. So it accepts the same attributes as `index`, plus: |
44 | 44 |
|
45 | | -* `%%index [attributes]%%` - Generates an index list of files and/or folders. Attributes can be used to control depth, file types, sorting, etc. |
46 | | - Attributes: |
47 | | - * `start` - The starting depth level to include in the index list (default: the current page's depth). |
48 | | - * `end` - The ending depth level (default: the current page's depth if `start` not provided, otherwise `5`). |
| 45 | +Attributes: |
| 46 | + |
| 47 | +* `orient` - The orientation of the menu: `horizontal` ~~or `vertical`~~ (default: `horizontal`). As of v7.6.0, only `horizontal` is implemented. You can use `%%index%%` to build vertical lists. |
| 48 | + |
| 49 | +#### Index list of files/folders (`%%index%%`) |
| 50 | + |
| 51 | +`%%index [attributes]%%` - Generates an index list of files and/or folders. Attributes can be used to control depth, file types, sorting, etc. |
| 52 | + |
| 53 | +Attributes: |
| 54 | + |
| 55 | +* `start` - The starting depth level to include in the index list (default: the current page's depth). |
| 56 | +* `end` - The ending depth level (default: the current page's depth if `start` not provided, otherwise `5`). |
49 | 57 |
|
50 | 58 | `start` and `end` are base 0, so the root folder is level 0. |
51 | 59 |
|
52 | | - * `depth` - Shorthand to set the number of levels to include. Equivalent to `end = start + depth`. |
53 | | - * `type` - The type of items to include: `files`, `folders`, or `both` (default: `both`). |
| 60 | +* `depth` - Shorthand to set the number of levels to include. Equivalent to `end = start + depth`. |
| 61 | +* `type` - The type of items to include: `files`, `folders`, or `both` (default: `both`). |
| 62 | +* `from` - Filter to include only items created/updated after this date/time. |
| 63 | +* `to` - Filter to include only items created/updated before this date/time. |
| 64 | + |
| 65 | + Can be set to `now` to mean the current date/time at the time of index list creation. |
| 66 | + |
| 67 | + `%%index[from=2025-01-01, to=now]%%` |
| 68 | + |
| 69 | + |
| 70 | +* `duration` - Filter to include only items created/updated offset from either `from` or `to`. |
54 | 71 |
|
55 | | - Not yet implemented: |
56 | | - * `sort` - The sorting order: `name`, `date`, or `custom` (default: `name`). |
57 | | - * `order` - The sorting direction: `asc` or `desc` (default: `asc`). |
58 | | - * `exclude` - Comma-separated list of file or folder names to exclude (default: none). |
| 72 | + E.g.: |
| 73 | + |
| 74 | + * `%%index[duration=1w]%%` Last week from now |
| 75 | + * `%%index[from=2025-06-01, duration=1m]%%` |
| 76 | + * `%%index[to=now, duration=2w]%%` |
| 77 | + * Duration can be negative to go backwards in time from `to`. E.g., `to=now, duration=-1m` for the month before now. |
| 78 | + |
| 79 | +* `latest` - Lists the last `n` created/updated items. Overrides `start`, `end`, and `depth`. |
| 80 | + |
| 81 | + E.g.: |
| 82 | + |
| 83 | + * `%%index[latest=10]%%`- 10 most recently created/updated pages. |
| 84 | + * `%%index[latest=5, type=files]%%` - 5 most recent files only. |
| 85 | + * `%%index[latest=3, start=0, end=2]%%` - 3 most recent pages at depth 0-2. |
| 86 | + * `%%index[latest=10, from=2025-01-01]%%` - 10 most recent since Jan 2025. |
| 87 | + |
| 88 | +*Not yet implemented*: |
| 89 | + |
| 90 | +* `sort` - The sorting order: `name`, `date`, or `custom` (default: `name`). |
| 91 | +* `order` - The sorting direction: `asc` or `desc` (default: `asc`). |
| 92 | +* `exclude` - Comma-separated list of file or folder names to exclude (default: none). |
| 93 | + |
| 94 | +#### Search results placeholder (`%%search-results%%`) |
59 | 95 |
|
60 | 96 | * `%%search-results%%` - Placeholder for search results. Currently has no attributes. |
61 | 97 |
|
| 98 | +#### Other directives |
| 99 | + |
62 | 100 | * `%%body%%` - Placeholder for the main content of the page. No attributes. |
63 | 101 |
|
64 | 102 | > [!NOTE] |
@@ -262,6 +300,8 @@ This is a rough list of the original requirements for the `uib-markweb` node. |
262 | 300 | * [x] Pass all discovered content attributes to the front end as a uibuilder managed variable. |
263 | 301 | * [x] `%%index%%` placeholder to generate a list of pages with links. Should use a template for each entry. Allow sorting options (e.g. by created date, updated date, title, etc.). Templates should allow metadata fields to be used. Index must allow pagination. Must have a filter option (e.g. by tag, category, author, date range, etc.) |
264 | 302 | * [x] Live reload of changed markdown files. [ref](https://www.npmjs.com/package/markserv) |
| 303 | +* [x] Generate title, created, updated page attributes from file details if not in front-matter. |
| 304 | +* [x] Watch the config folder for changes. Signal all connected clients to reload page if config files change. |
265 | 305 |
|
266 | 306 |
|
267 | 307 | ### Search |
|
0 commit comments