feat(embeds): geo/gpx/3D/YouTube/media keyword system + docs, sanitized mirrors

- new snippet geo_map_render.js: [map] inline geomaps (tree order, tint,
  theme-following), [gpx] stats card + elevation profile with hover cursor
  (km from start, d-height, vertical guide), [yt] privacy click-to-load
  facade, [video]/[audio] inline players fed from the new geoData indexes
- 3d_model_viewer.js: [cad] keyword + title/ID resolution via geoData.cad,
  sizes/captions, real occt-wasm ESM pair (fixes 'STEP worker error'),
  code-span-safe keyword scan (docs can show examples)
- blog_generator.js: buildGeoData() v6 – maps (geolocation + geoShape
  point/line/polygon + child GPX tracks), gpx/cad/media indexes,
  branch-change rebuild for route reordering
- generated/geo_data.js placeholder; docs/embed-keywords.md (new) +
  embed-3d-model Option D; README layout/wiring/notes tables updated
- license: runtime components (MapLibre ISC, VersaTiles MIT/ODbL, YouTube)
- hygiene: removed leaked note IDs and instance domain from theme docs
This commit is contained in:
trilium-share-gruvbox
2026-09-28 14:53:51 +02:00
parent 9e456bbaaa
commit 2818c40f96
10 changed files with 933 additions and 28 deletions
+17 -7
View File
@@ -75,6 +75,11 @@ pointing the `shareCss` relation at the matching note – see
battery module). See [docs/embed-3d-model.md](docs/embed-3d-model.md).
- **3D viewer inside Trilium (app widget)**: the same viewer runs in the Trilium app itself
(independent of the blog) via a `note-detail-pane` widget – see `app/`.
- **Inline embed keywords**: plain-text keywords render interactive widgets in any shared note —
`[map]` (MapLibre + VersaTiles vector maps with route lines, GPX/geoShape tracks and popups),
`[gpx]` (track stats + elevation profile with hover measurement cursor), `[cad]` (3D viewer),
`[yt]` (privacy-friendly YouTube click-to-load facade), `[video]` / `[audio]` (stream media file
notes). Everything follows the blog theme. See [docs/embed-keywords.md](docs/embed-keywords.md).
- Code highlighting (highlight.js + line numbers) and copy buttons on all code boxes.
- Optional "Buy me a coffee" button with locally-hosted Cookie font.
- `blog_generator` (backend) builds index/feed/sitemap/search-data; `blog_publish_manager` moves
@@ -105,6 +110,7 @@ pointing the `shareCss` relation at the matching note – see
| `templates/share/*.ejs` | custom share template + partials (canonical, OG, JSON-LD, robots) | code, `application/x-ejs` |
| `assets/og-banner.png` | default Open Graph image (1200×630, replace with your own) | file |
| `docs/embed-3d-model.md` | how to embed STEP/STL in a note | – |
| `docs/embed-keywords.md` | reference for the inline embed keywords (map/gpx/cad/yt/video/audio) | – |
| `examples/*` | sample category logo + menu icon script (ignis8) | code / SVG |
| `generated/*` | reference output, **regenerated automatically** by `blog_generator.js` | code / xml |
@@ -126,7 +132,7 @@ pointing the `shareCss` relation at the matching note – see
```
root
└── Blog (book)
├── Richard's Blog (book) ← blog root, the shared note
├── Your Blog (book) ← blog root, the shared note
│ ├── .blog (book) ← system notes (scripts, css, data)
│ ├── Astrophotography (book) ← example category
│ ├── Electronic (book)
@@ -177,15 +183,19 @@ Under **`.blog`** create one code note per file, using the file name as the note
| `note fallback` | `scripts/note_fallback.js` | `text/html` |
| `menu date sort` | `scripts/menu_date_sort.js` | `text/html` |
| `3d model viewer` | `scripts/3d_model_viewer.js` | `text/html` |
| `geo map render` | `scripts/geo_map_render.js` | `text/html` |
| `three.js` | `lib/3d/three.min.js` | `application/javascript` |
| `three orbit controls` | `lib/3d/OrbitControls.js` | `application/javascript` |
| `three stl loader` | `lib/3d/STLLoader.js` | `application/javascript` |
| `occt-import-js` | `lib/3d/occt-import-js.js` | `application/javascript` |
| `occt-import-js.wasm` | `lib/3d/occt-import-js.wasm` | `application/wasm` (file note) |
| `occt-wasm bundle` | `lib/3d/occt-wasm-bundle.js` | `application/javascript` (ESM `OcctKernel`, used by the `[cad]` viewer worker) |
| `occt-wasm.wasm` | `lib/3d/occt-wasm.wasm` | `application/wasm` (file note) |
| `feed.xml` | `generated/feed.xml` | code (regenerated) |
| `sitemap.xml` | `generated/sitemap.xml` | code (regenerated) |
| `state_map` | `generated/state_map.js` | `text/html` (regenerated) |
| `blog_data` | `generated/blog_data.js` | `text/html` (regenerated) |
| `geo_data` | `generated/geo_data.js` | `text/html` (regenerated; auto-created **and** auto-attached as `shareHtml` by `buildGeoData()`) |
| `robots.txt` | `generated/robots.txt` | code (static) |
| `share template` | `templates/share/page.ejs` | `application/x-ejs` |
| `tree_item`, `prev_next`, `toc_item` (children of `share template`) | `templates/share/tree_item.ejs` etc. | `application/x-ejs` |
@@ -197,7 +207,7 @@ mime `application/javascript;env=backend`) and `blog_publish_manager` (from
### 3. Wire the attributes
**On the blog root note** (`Richard's Blog`), add:
**On the blog root note** (`Your Blog`), add:
| Attribute | Value | Inheritable |
|---|---|---|
@@ -212,9 +222,9 @@ mime `application/javascript;env=backend`) and `blog_publish_manager` (from
| `~shareFavicon` | → `favicon` | yes |
| `~shareTemplate` | → `share template` | yes |
| `~shareOpenGraphImage` | → `og-banner` | – |
| `~shareHtml` | → `table column hover`, `blog card click`, `garden row click`, `code note highlight`, `code copy & lines`, `state_map`, `title state badge`, `bmc button`, `logo share alias`, `blog_data`, `prev next`, `reading time`, `search header`, `ignis8 menu icon` (optional), `note fallback`, `menu date sort`, `3d model viewer` | yes |
| `~shareHtml` | → `table column hover`, `blog card click`, `garden row click`, `code note highlight`, `code copy & lines`, `state_map`, `title state badge`, `bmc button`, `logo share alias`, `blog_data`, `prev next`, `reading time`, `search header`, `ignis8 menu icon` (optional), `note fallback`, `menu date sort`, `3d model viewer`, `geo map render` | yes |
| `~shareHtml` | → `hide home title` | **no** (index only) |
| `~runOnNoteContentChange`, `~runOnAttributeChange`, `~runOnNoteCreation`, `~runOnNoteTitleChange`, `~runOnAttributeCreation`, `~runOnBranchDeletion`, `~runOnChildNoteCreation` | → `blog_generator` | yes |
| `~runOnNoteContentChange`, `~runOnAttributeChange`, `~runOnNoteCreation`, `~runOnNoteTitleChange`, `~runOnAttributeCreation`, `~runOnBranchDeletion`, `~runOnBranchChange`, `~runOnChildNoteCreation` | → `blog_generator` | yes |
| `~runOnAttributeChange`, `~runOnAttributeCreation` | → `blog_publish_manager` | yes |
**On the script notes** (under `.blog`), add:
@@ -257,7 +267,7 @@ placeholder tokens. Replace every `__TOKEN__` with the real note ID of the corre
| Token | Replace with note |
|---|---|
| `__BLOG_ROOT_ID__` | `Richard's Blog` |
| `__BLOG_ROOT_ID__` | `Your Blog` |
| `__BLOG_SYSTEM_ID__` | `.blog` |
| `__UNPUBLISHED_ROOT_ID__` | `Unpublished` |
| `__BLOG_GENERATOR_ID__` | `blog_generator` |
@@ -283,7 +293,7 @@ Then edit the constants at the top of `blog_generator.js` and `blog_publish_mana
### 5. Enable Public Share and generate
1. On `Richard's Blog` right-click → *Share* → enable sharing.
1. On `Your Blog` right-click → *Share* → enable sharing.
2. Run the generator once: execute the `blog_generator` script (e.g. press play in the script
editor, or trigger any attribute/content change). It is also wired to run automatically on
every relevant change (`runOn*`), and you can add `run=daily` to it for a nightly run.
@@ -293,7 +303,7 @@ Then edit the constants at the top of `blog_generator.js` and `blog_publish_mana
1. Create a note from the `templates/blog_article.html` content (or clone the template note).
It promotes the `publish`, `date`, `category`, `summary`, `shareAlias` and `tags` labels.
2. Put it under a category inside `Richard's Blog` and set `publish=true`.
2. Put it under a category inside `Your Blog` and set `publish=true`.
3. To keep it private, put it under `Unpublished` instead – `blog_publish_manager` clones it
into the matching category (and back) when you flip `publish`.