How Can Add The Meta Tags Using Unhead In Vue.js

In this article, we will learn how to add the meta tags using unhead in vue.js

Step 1: Create a new Vue project:

vue create unhead-demo

Step 2: Install require packages:

nmpm i vue-router unhead

Step3: Open main.js file and add the following in it:

import { createApp } from 'vue'
import App from './App.vue'
import { createHead } from 'unhead'
const head = createHead()


Step 4: Open App.vue file and add the following in it:

  <img alt="Vue logo" src="./assets/logo.png" />
  <h1>Unhead demo</h1>

import { useHead } from "unhead";

export default {
  name: "App",
  mounted() {
      title: "My demo site",
      meta: [
          name: "title",
          content: "My demo site",
      link: [
          rel: "stylesheet",
          href: "",

#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;

Code in Action:

Submit a Comment

Your email address will not be published. Required fields are marked *


Select Categories