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.

HeadInput

interfaz Since 1.2.0

Lo que una configuración, un layout, una página o un componente aporta al <head> del documento y a los atributos de <html> y <body>. Lo reciben useHead, document.head de meeko.config.ts y los módulos de Meeko.

ts
import type { HeadInput } from "@meekojs/meeko/framework";

Source code src/shared/head.ts:141

Declaración #

ts
interface HeadInput {
	title?: string
	titleTemplate?: string | ((title: string) => string)
	meta?: HeadMeta[]
	link?: HeadLink[]
	script?: HeadScript[]
	style?: HeadStyle[]
	htmlAttrs?: Record<string, string | undefined> & HeadEventAttributes
	bodyAttrs?: Record<string, string | undefined> & HeadEventAttributes
}

Example #

ts
import type { HeadInput } from "@meekojs/meeko/framework";

const head: HeadInput = {
  title: "Documentación",
  titleTemplate: "%s · Meeko",
  meta: [{ name: "description", content: "Guía del framework" }],
  link: [{ rel: "canonical", href: "https://meeko.dev/docs" }],
  htmlAttrs: { lang: "es" },
};

Propiedades #

title #

propiedad opcional

title?: string

Título del documento; gana el de más prioridad. Si el que gana es una cadena vacía, se muestra el title de document.head, sin plantilla.

titleTemplate #

propiedad opcional

titleTemplate?: string | ((title: string) => string)

Plantilla del título: %s es el título, o una función que lo recibe. Se aplica al título de layouts, páginas, useHead y el head de la ruta, nunca al title de document.head.

meta #

propiedad opcional

meta?: HeadMeta[]

Etiquetas <meta>.

propiedad opcional

link?: HeadLink[]

Etiquetas <link>.

script #

propiedad opcional

script?: HeadScript[]

Etiquetas <script>.

style #

propiedad opcional

style?: HeadStyle[]

Etiquetas <style>.

htmlAttrs #

propiedad opcional

htmlAttrs?: Record<string, string | undefined> & HeadEventAttributes

Atributos de <html>, como lang, dir, class o data-*; undefined no aporta nada. Un manejador on* lanza en ejecución; desde 1.7, los de los eventos del DOM (onclick, onload…) son además un error de tipos.

bodyAttrs #

propiedad opcional

bodyAttrs?: Record<string, string | undefined> & HeadEventAttributes

Atributos de <body>; undefined no aporta nada. Como en htmlAttrs, sin manejadores on*.

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/shared/head.ts