description

Type: string | null | ((pageContext) => string | null | undefined)
Kind: overridable.
Environment: server.

Implemented by: vike-react/vike-vue/vike-solid.

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.'
}

It adds the following tags 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>

As shown at:

TypeScript

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

Under the hood

It only generates <head> tags while rendering the HTML of the first page the user visits: the <head> tags aren't updated upon client-side page navigation. The reason is that it's only meant for HTML crawlers (most notably search engine bots), see explanation at API > Head > Only HTML.

See also