Skip to content
Meeko
Type to search the guides and the API reference. Open it from any page with / or Ctrl K; move with the arrow keys and open a result with Enter.
Get started

Contents

On this page

Not translated yet

This page has not been translated into English yet, so it is shown in Spanish.

DocumentOptions

interfaz

Añadidos del host al documento HTML que renderiza Meeko.

ts
import type { DocumentOptions } from "@meekojs/meeko/server";

Source code src/server/runtime/framework-render.ts:273

Declaración #

ts
interface DocumentOptions {
	readonly head?: DocumentMarkup
	readonly bodyEnd?: DocumentMarkup
	readonly nonce?: (request: Request) => string | undefined
	readonly config?: DocumentConfig
}

Example #

ts
import type { DocumentOptions } from "@meekojs/meeko/server";

const document: DocumentOptions = {
  head: '<link rel="stylesheet" href="/fonts.css">',
  bodyEnd: ({ nonce }) => `<script nonce="${nonce ?? ""}">console.log("listo")</script>`,
  nonce: (request) => request.headers.get("x-csp-nonce") ?? undefined,
};

Propiedades #

propiedad sólo lectura opcional

readonly head?: DocumentMarkup

HTML de confianza que se añade a <head>, como hojas de estilo y enlaces modulepreload.

bodyEnd #

propiedad sólo lectura opcional

readonly bodyEnd?: DocumentMarkup

HTML de confianza que se añade antes de </body>, tras la entrada del cliente.

nonce #

propiedad sólo lectura opcional

readonly nonce?: (request: Request) => string | undefined

Nonce CSP por petición, que se aplica a las etiquetas <style> de Meeko, a la entrada del cliente y, desde 1.2, a los <script> y <style> de useHead y document.

config #

propiedad sólo lectura opcional since 1.2.0

readonly config?: DocumentConfig

Documento de la aplicación: lang, atributos de <html> y <body> y etiquetas de <head>, con la menor prioridad frente a useHead y al head de las páginas. createServerApp lo toma de document de meeko.config.ts; un host propio debe pasar el mismo valor a mountClientApp({ document }).

See also #

Was this page helpful?

Add a comment

It is sent when you choose “Yes” or “No”. Only the page, your answer and the comment are stored: no cookies and no personal data.

0 of 2000 characters

Edit on GitHub: packages/meeko/src/server/runtime/framework-render.ts