guides

Client Only Tags

Learn how to use server only tags.

The second argument with any of the useHead composables, is an options object with a property called mode.

This mode field can be used to indicate if the tag should be rendered on the client.

useHead({
  title: 'hello'
}, { mode: 'client' })

This can be useful for instances where you don't want a script to run until the rest of the app is hydrated.

Examples

Analytics script only after app hydration

useHead({
  script: [
    {
      src: 'https://example.com/analytics.js',
    }
  ]
}, { mode: 'client' })