@getvitops/emdash 0.3.4 → 0.3.5

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @getvitops/emdash
2
2
 
3
+ ## 0.3.5
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @getvitops/utils@5.0.0
9
+
3
10
  ## 0.3.4
4
11
 
5
12
  ### Patch Changes
package/README.md CHANGED
@@ -38,6 +38,56 @@ export default defineConfig({
38
38
 
39
39
  Tested against `emdash@0.31.x`.
40
40
 
41
+ ## Rendering mode
42
+
43
+ An EmDash site **must** run `output: 'server'` with an adapter — the admin at `/_emdash/admin`,
44
+ the media and API routes, preview tokens and scheduled publishing all need a server, and
45
+ `vitopsHosting()` supplies the adapter. That makes prerendering **per-route and opt-in**, the
46
+ opposite of a plain Astro site (which should stay `output: 'static'` and opt _out_ with
47
+ `export const prerender = false` — see [`@getvitops/astro`](../astro/README.md#rendering-mode)).
48
+
49
+ So on an EmDash site:
50
+
51
+ - **Put `export const prerender = true` on every page that doesn't need per-request data** — the
52
+ home page, legal pages, anything whose content is known at build time. A route with no
53
+ `prerender` export is rendered again for every visitor on every request.
54
+ - **Give dynamic routes a `getStaticPaths()`** so database-backed pages build to static HTML too.
55
+ Query the collection at build time and return one entry per path:
56
+
57
+ ```astro
58
+ ---
59
+ // src/pages/[...slug].astro
60
+ import { getEmDashCollection, getEmDashEntry } from 'emdash';
61
+ import { PortableText } from 'emdash/ui';
62
+ import Layout from '../layouts/Layout.astro';
63
+
64
+ export const prerender = true;
65
+
66
+ export async function getStaticPaths() {
67
+ const { entries } = await getEmDashCollection('pages', { status: 'published' });
68
+ return entries.map((entry) => ({ params: { slug: entry.slug } }));
69
+ }
70
+
71
+ const { slug } = Astro.params;
72
+ const { entry: page } = await getEmDashEntry('pages', slug);
73
+ ---
74
+
75
+ <Layout title={page.data.title}>
76
+ <PortableText value={page.data.content} />
77
+ </Layout>
78
+ ```
79
+
80
+ The trade-off is deliberate and worth stating: **a prerendered page reflects the database as of the
81
+ last build**, so publishing from the admin only appears after a redeploy. Leave a route
82
+ server-rendered when that is unacceptable — the preview route (draft content is served at request
83
+ time via a signed token), a page that must go live within seconds, or anything personalised. That
84
+ is the narrow case, not the default.
85
+
86
+ One exception to the exception: if you are building a **distributable EmDash theme** rather than a
87
+ site, EmDash's own guidance is that content pages must stay server-rendered, since a theme's users
88
+ edit content through the admin and expect it live. The rule above is for a site you build and
89
+ deploy yourself.
90
+
41
91
  ## Hosting seam: `vitopsHosting()`
42
92
 
43
93
  One call resolves the Astro adapter + EmDash database/storage for a hosting
package/dist/index.mjs CHANGED
@@ -358,7 +358,7 @@ async function vitopsHosting(options = {}) {
358
358
 
359
359
  //#endregion
360
360
  //#region package.json
361
- var version = "0.3.4";
361
+ var version = "0.3.5";
362
362
 
363
363
  //#endregion
364
364
  //#region src/index.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getvitops/emdash",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "description": "EmDash CMS native plugin for the Vitops design system — Portable Text block types editors can insert from the admin, rendered with the design-system web components and CSS framework.",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -22,7 +22,7 @@
22
22
  "access": "public"
23
23
  },
24
24
  "dependencies": {
25
- "@getvitops/utils": "4.1.0"
25
+ "@getvitops/utils": "5.0.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@astrojs/cloudflare": "^14.0.0",
@@ -30,7 +30,7 @@
30
30
  "astro": "^7.1.2",
31
31
  "emdash": "^0.31.0",
32
32
  "vitest": "^4.1.9",
33
- "@getvitops/astro": "4.1.0"
33
+ "@getvitops/astro": "5.0.0"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "@astrojs/cloudflare": ">=14",