Edit

+description

Environment: client, server
type Value = string | null | undefined
type Description = Value | ((pageContext) => Value)

Per-page
vike-react/vike-vue/vike-solid setting

You need vike-react/vike-vue/vike-solid to be able to use this setting.

See Guides > <head> tags for a general introduction about <head> tags.

The +description setting sets the SEO description tags.

// pages/+config.js
 
export default {
  description: 'This website is a Vike demo.'
}
// pages/+config.ts
 
import type { Config } from 'vike/types'
 
export default {
  description: 'This website is a Vike demo.'
} satisfies Config

It adds <meta name="description"> and <meta property="og:description"> to <head>:

<head>
  <meta name="description" content="This website is a Vike demo.">
  <meta property="og:description" content="This website is a Vike demo.">
</head>

You can set its value using a pageContext function:

// pages/some-page/+description.js
// Environment: server, client
 
export function description(pageContext) {
  return pageContext.data.product.description
}
// pages/some-page/+description.ts
// Environment: server, client
 
import type { Data } from './+data'
import type { PageContext } from 'vike/types'
 
export function description(pageContext: PageContext<Data>) {
  return pageContext.data.product.description
}

Under the hood

On the server, upon rendering the HTML of the first page, the +description setting adds the <meta name="description"> and <meta property="og:description"> tags to the <head> tag.

On the client, upon client-side page navigation, the +description setting dynamically updates these tags by mutating the DOM.

See also