@vueuse/head
Document head manager for Vue 3. SSR ready.
Last updated 4 years ago by egoist .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @vueuse/head 
SYNC missed versions from official npm registry.

@vueuse/head

NPM version NPM Downloads GitHub stars

Document head management for Vue. Powered by Unhead.


Created by egoist, maintained by harlan-zw
???? Support ongoing development by sponsoring us.
Follow ???? @harlan_zw for updates • Join Discord for support

???? Sunsetting @vueuse/head

The @vueuse/head package is a simple compatible wrapper around Unhead, they share an almost identical API. In the coming months, the @vueuse/head package will be deprecated. If you're setting up this package on a new project, you should use the @unhead/vue package directly. Further documentation, guides and announcements will be out soon, for now you can follow the installation guide.

Features

  • ???? Fully typed augmentable Schema
  • ????‍????‍???? Side-effect based DOM patching, plays nicely your existing other tags and attributes
  • ???? Intuitive deduping, sorting, title templates, class merging and more
  • ???? Extensible hook / plugin based API

Installation

npm i @vueuse/head
# Or Yarn
yarn add @vueuse/head

Requires vue >= v3 or >=2.7

Usage

Vue 3

Register the Vue plugin:

import { createApp } from "vue"
import { createHead } from "@vueuse/head"

const app = createApp()
const head = createHead()

app.use(head)

app.mount("#app")

Vue 2

Register the Vue plugin:

import Vue from 'vue'
import { createHead, HeadVuePlugin } from "@vueuse/head"

const head = createHead()
// needed for Vue 2
Vue.use(HeadVuePlugin, head)
Vue.use(head)

new Vue({
  render: h => h(App),
}).$mount('#app')

SSR Rendering

import { renderToString } from "@vue/server-renderer"
import { renderHeadToString } from "@vueuse/head"

const appHTML = await renderToString(yourVueApp)

// `head` is created from `createHead()`
const { headTags, htmlAttrs, bodyAttrs, bodyTags } = await renderHeadToString(head)

const finalHTML = `
<html${htmlAttrs}>

  <head>
    ${headTags}
  </head>

  <body${bodyAttrs}>
    <div id="app">${appHTML}</div>
    ${bodyTags}
  </body>

</html>`

Further Documentation

Refer to the unhead documentation for full API reference and more.

Sponsors

License

MIT © EGOIST MIT License © 2022-PRESENT Harlan Wilton

Current Tags

  • 1.1.26                                ...           latest (3 years ago)
  • 1.0.0-next.3                                ...           next (3 years ago)
  • 1.0.0-rc.14                                ...           rc (3 years ago)

95 Versions

  • 1.1.26                                ...           3 years ago
  • 1.1.23                                ...           3 years ago
  • 1.1.19                                ...           3 years ago
  • 1.1.15                                ...           3 years ago
  • 1.1.9                                ...           3 years ago
  • 1.1.8                                ...           3 years ago
  • 1.1.7                                ...           3 years ago
  • 1.1.5                                ...           3 years ago
  • 1.1.4                                ...           3 years ago
  • 1.1.3                                ...           3 years ago
  • 1.1.1                                ...           3 years ago
  • 1.1.0                                ...           3 years ago
  • 1.0.26                                ...           3 years ago
  • 1.0.25                                ...           3 years ago
  • 1.0.24                                ...           3 years ago
  • 1.0.23                                ...           3 years ago
  • 1.0.22                                ...           3 years ago
  • 1.0.21                                ...           3 years ago
  • 1.0.20                                ...           3 years ago
  • 1.0.19                                ...           3 years ago
  • 1.0.18                                ...           3 years ago
  • 1.0.17                                ...           3 years ago
  • 1.0.16                                ...           3 years ago
  • 1.0.15                                ...           3 years ago
  • 1.0.14                                ...           3 years ago
  • 1.0.13                                ...           3 years ago
  • 1.0.12                                ...           3 years ago
  • 1.0.11                                ...           3 years ago
  • 1.0.10                                ...           3 years ago
  • 1.0.9                                ...           3 years ago
  • 1.0.8                                ...           3 years ago
  • 1.0.7                                ...           3 years ago
  • 1.0.6                                ...           3 years ago
  • 1.0.5                                ...           3 years ago
  • 1.0.4                                ...           3 years ago
  • 1.0.3                                ...           3 years ago
  • 1.0.2                                ...           3 years ago
  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
  • 1.0.0-next.3                                ...           3 years ago
  • 1.0.0-next.2                                ...           3 years ago
  • 1.0.0-next.1                                ...           3 years ago
  • 1.0.0-rc.14                                ...           3 years ago
  • 1.0.0-rc.13                                ...           3 years ago
  • 1.0.0-rc.12                                ...           3 years ago
  • 1.0.0-rc.11                                ...           3 years ago
  • 1.0.0-rc.10                                ...           3 years ago
  • 1.0.0-rc.9                                ...           3 years ago
  • 1.0.0-rc.8                                ...           3 years ago
  • 1.0.0-rc.7                                ...           3 years ago
  • 1.0.0-rc.6                                ...           3 years ago
  • 1.0.0-rc.5                                ...           4 years ago
  • 1.0.0-rc.4                                ...           4 years ago
  • 1.0.0-rc.3                                ...           4 years ago
  • 1.0.0-rc.2                                ...           4 years ago
  • 0.9.8                                ...           4 years ago
  • 1.0.0-rc.1                                ...           4 years ago
  • 0.9.7                                ...           4 years ago
  • 0.9.6                                ...           4 years ago
  • 0.9.5                                ...           4 years ago
  • 0.9.4                                ...           4 years ago
  • 0.9.3                                ...           4 years ago
  • 0.9.2                                ...           4 years ago
  • 0.9.1                                ...           4 years ago
  • 0.9.0                                ...           4 years ago
  • 0.8.2                                ...           4 years ago
  • 0.8.1                                ...           4 years ago
  • 0.8.0                                ...           4 years ago
  • 0.7.13                                ...           4 years ago
  • 0.7.12                                ...           4 years ago
  • 0.7.11                                ...           4 years ago
  • 0.7.10                                ...           4 years ago
  • 0.7.9                                ...           4 years ago
  • 0.7.8                                ...           4 years ago
  • 0.7.7                                ...           4 years ago
  • 0.7.6                                ...           4 years ago
  • 0.7.5                                ...           4 years ago
  • 0.7.4                                ...           4 years ago
  • 0.7.3                                ...           4 years ago
  • 0.7.2                                ...           4 years ago
  • 0.7.1                                ...           4 years ago
  • 0.7.0                                ...           4 years ago
  • 0.6.0                                ...           5 years ago
  • 0.5.1                                ...           5 years ago
  • 0.5.0                                ...           5 years ago
  • 0.4.0                                ...           5 years ago
  • 0.3.2                                ...           5 years ago
  • 0.3.1                                ...           5 years ago
  • 0.3.0                                ...           5 years ago
  • 0.2.3                                ...           5 years ago
  • 0.2.2                                ...           5 years ago
  • 0.2.1                                ...           5 years ago
  • 0.2.0                                ...           5 years ago
  • 0.1.3                                ...           5 years ago
  • 0.1.0                                ...           5 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 2
Last Month 2
Dependencies (0)
None
Dev Dependencies (20)
Dependents (2)

Copyright 2013 - present © cnpmjs.org | Home |