{page.heading}
``` * `Content/ByUrl` has a row for each page and language. A page's pending edits and scheduled publish are rows too, at the same address, so the query always filters on `status`. * Visitors get the `published` row. * In live preview, `Astro.locals.editMode` is `true`. The page then shows the pending edits (`draft`), or a page that was never published (`unpublished`). * [Index URL](https://strife.app/docs/reference/database/index-url.md) describes every kind of row. * `selectFields` returns each field in the row's language. Without it, the query returns the whole document, where a translated field is an object such as `{ en: '…' }`. * `.noCaching()` stops the RavenDB client from caching a response for every address someone tries, which matters in a catch-all route. * `set:html` renders the rich text body's HTML. Start the dev server with `npm run dev` and open the page's address. ### 7. Turn on live preview `{heading}
{home.heading}
``` #### Check accessibility and page weight To have Studio check the page's accessibility and weight in the preview, add the `
Employee Content Template

Chapters settings
@Model?.Name
@Model?.Role-
@foreach (var employee in Model.Employees)
{

Simple Blog List Template

Simple Blog Post Template
@Model?.Heading
```
`width` and `height` are the field's size: they only give the aspect ratio, so the browser reserves the right space before the file arrives and nothing jumps. In this example the original is 1672 pixels wide, so the largest candidate is 1672w, not 3200w: Strife never makes a candidate wider than the original.
### Check what the browser picked
Open the page with DevTools' device toolbar, select the image in the **Elements** panel and read `currentSrc` in the **Properties** pane (or filter the **Network** panel by **Img**). The `w:` in the URL is the candidate's width. For the hero above, a 390-pixel phone at 3x needs 1170 pixels and gets the 1216w candidate, and a 768-pixel tablet at 2x needs 1536 and gets 1672w, the largest there is. Reload after each change of screen size: a browser that already has a larger candidate in its cache may keep using it.
> [!NOTE]
> A change to `width`, `height` or `widths` in your schema reaches each image the next time an editor picks or crops it; until then the image keeps the candidates it was saved with. To get large candidates, upload originals at least as wide as the field's `width`.
### Live preview
While an editor zooms or pans an image in Strife Studio, the preview receives a temporary picture in `source.url` and no `source.srcset`; the candidates follow when the editor lets go. If your page updates images live (through `subscribe`, see [Custom Live Preview implementation](https://strife.app/docs/reference/live-preview/custom-live-preview-implementation.md)), remove `srcset` and `sizes` when the value has none. Otherwise the browser keeps showing the old candidates instead of the new picture:
```js
img.src = image.source.url;
if (image.source.srcset) {
img.srcset = image.source.srcset;
img.sizes = sizes;
} else {
img.removeAttribute('srcset');
img.removeAttribute('sizes');
}
```
## Placeholder
`source.placeholder` is the image's average color. Use it as a background so the reserved space isn't empty while the image loads:
```astro
Page sections
" }, "options": { "availableTypes": [ "text", "content", "hero", "bento" ] } }, } ], "templateType": "dt", "normalizedName": "page", "disableURL": false, "archived": false, "icon": "home", "hint": "A demo page", "searchFields": [], "filterFields": [], "composable": true, "filterable": true, "@metadata": { "@collection": "Templates", "Raven-Clr-Type": "Wieldy.Core.Models.Template, Wieldy.Core" } } ``` --- # Global configs Source: https://strife.app/docs/reference/globals Declare site-wide settings such as the navigation or the footer as global configs in strife.config.ts. Editors fill them in from the team menu and your site reads the published values by id. A global config is one document of site-wide settings: the navigation, the footer, the cookie banner, the site's contact details. Each global has a fixed set of fields that you declare in `strife.config.ts`. Editors fill it in from the team menu, with the same draft and publish flow as a page. Your site reads the published values by an id you already know. Before globals, the usual approach was a template plus one content document, and the site kept that document's id in its configuration. A global replaces both: * There is no id to copy between environments. The id comes from the global's name. * Globals are not listed in the content list. * An editor cannot create a second instance or delete the global. ## Declare a global Add a `globals` list to `defineConfig`. Each entry is a `defineGlobal`, and its `fields` take the same `fields.*` builders as [`defineType`](https://strife.app/docs/reference/cli/schemas.md): ```ts title="strife.config.ts" import { defineConfig, defineGlobal, fields, glob } from '@strifeapp/strife/schema'; export default defineConfig({ schema: glob('./src/schemas/**/*.ts'), globals: [ defineGlobal({ name: 'footer', label: 'Footer', icon: 'layout', fields: { heading: fields.text({ label: 'Heading', localizable: true }), description: fields.paragraph({ label: 'Description', localizable: true }), newsletter: fields.toggle({ label: 'Show newsletter sign-up' }), }, }), defineGlobal({ name: 'site-settings', label: 'Site settings', icon: 'settings', fields: { contactEmail: fields.text({ label: 'Contact email' }), }, }), ], }); ``` | Option | Description | | -------- | ----------- | | `name` | Required. The global's identity and part of its id. Lowercase letters, digits and hyphens, starting with a letter, at most 64 characters (`footer`, `site-settings`). `draft`, `scheduled` and `snapshot` are not allowed. | | `label` | Shown in the team menu. Defaults to `name`. | | `icon` | Required. The icon shown next to the global in the team menu. See [Icons](https://strife.app/docs/reference/icons.md). | | `fields` | Required. An object of `fields.*` builders, exactly as in `defineType`. `localizable: true` gives a field one value per locale. | A team can have at most 50 globals. The team menu lists them in the order of the `globals` list. > [!WARNING] > The name is the identity. If you rename a global, you get a new, empty global, and the old one is hidden with its values. Pick names you can keep. ## Push it `strife push` sends the globals to the linked team together with the templates, and lists what changed: ``` ✓ Pushed globals (2 globals) Added globals: footer, site-settings ``` `strife push` checks the list before it sends anything. An invalid name, a reserved name, a duplicate name or more than 50 globals stops the push with a message that names the global, and nothing on the team changes. | Your config | What happens on the team | | ----------- | ------------------------ | | A global is in `globals` | It is added, or its label, icon, order and fields are updated. | | A global is no longer in `globals` | It is hidden from editors. Its values are kept. Push it again and it comes back with them. | | `globals: []` | Every global is hidden. Their values are kept. | | No `globals` key | Globals are left as they are. A push from an older branch or another project does not hide them. | Changing a global's fields works like changing a template's fields. The values of fields that still exist are kept, and the values of removed fields are hidden, not deleted. `strife push --dry-run` prints the globals it would send without changing anything. ## How editors use it Editors open globals from the team's **…** menu, where every global the team has is listed under **Configurations**. A global opens in a full-screen editor with its fields, a status card, and **Discard** and **Publish** at the bottom. * An edit is saved as a draft. Your site does not see it until an editor publishes. * On a team with several locales, the locale switcher and per-locale publish and discard work as they do for pages. * Editing and discarding need the same permission as editing content. Publishing needs the same permission as publishing content. * A global that has never been published opens with empty fields. Globals are edited in the new Strife interface. The classic interface does not list them. ## Read it on your site The published values live in a document with the id `Configurations/globals/