In this article, we are going to learn how meta tags and SEO work in NuxtJs. Nuxt.js is a free and open-source web application framework based on Vue.js, Node.js, Webpack, and Babel.js. Nuxt is inspired by Next.js, which is a framework of a similar purpose, based on React.js.
Create NuxtJS Application:
Step 1: You can create a new NuxtJs project using the below command:
npx create-nuxt-app gfg
Step 2: Now navigate to your app using the following command:
cd gfg
Project Structure: It will look like this.

Meta Tags: Meta tags are used to provide metadata of the web page. They are part of the head section of the web page and help in SEO and ranking of the web page.
Add Meta Tags in Nuxt.Js: There are 2 different methods you can use to add meta tags in your page.
1. Global Settings:
You can add the meta tags in your nuxt.config.js file. These meta tags will be applied to every page of your website. For this, add the below code to the nuxt.config.js file of your application.
nuxt.config.js
export default {
// Disable server-side rendering:
// https://go.nuxtjs.dev/ssr-mode
ssr: true,
// Global page headers:
// https://go.nuxtjs.dev/config-head
head: {
title: 'gfg',
htmlAttrs: {
lang: 'en'
},
meta: [
{ charset: 'utf-8' },
{ name: 'viewport',
content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: '' },
{ name: 'format-detection', content: 'telephone=no' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
]
},
// Global CSS: https://go.nuxtjs.dev/config-css
css: [
'view-design/dist/styles/iview.css'
],
// Plugins to run before rendering page:
// https://go.nuxtjs.dev/config-plugins
plugins: [
'@/plugins/view-ui',
{ src: '~/plugins/vue-datepicker', ssr: false },
{ src: '~/plugins/vue-time', ssr: false },
],
// Auto import components:
// https://go.nuxtjs.dev/config-components
components: true,
// Modules for dev and build (recommended):
// https://go.nuxtjs.dev/config-modules
buildModules: [
],
// Modules: https://go.nuxtjs.dev/config-modules
modules: [
],
// Build Configuration:
// https://go.nuxtjs.dev/config-build
build: {
}
}
Here we are using the Head tag to add the meta tags.
Start the application: Run the application using the below code.
npm run dev
Output:
2. Local Settings:
You can add meta tags on a single page using the Head tag as a function.
For example: Add the below content to your 'index.vue' and 'gfg.vue' files:
index.vue
<template>
<div>
<h3>This is the Home Page.</h3>
<NuxtLink to="/gfg">
Go to GFG Page
</NuxtLink>
</div>
</template>
<script>
export default {
head() {
return {
title:'Home page',
script: [
{
src:
'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js'
}
],
link: [
{
rel: 'stylesheet',
href:
'https://fonts.googleapis.com/css?family=Roboto&display=swap'
}
]
}
}
}
</script>
gfg.vue
<template>
<div>
<h3>This is the GFG Page.</h3>
<NuxtLink to="/">
Go to HomePage
</NuxtLink>
</div>
</template>
<script>
export default {
head() {
return {
title:'gfg page',
script: [
{
src:
'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js'
}
],
link: [
{
rel: 'stylesheet',
href:
'https://fonts.googleapis.com/css?family=Roboto&display=swap'
}
]
}
}
}
</script>
Start the application: Run the application using the below code.
npm run dev
Output:
Similar Reads
JavaScript Tutorial JavaScript is a programming language used to create dynamic content for websites. It is a lightweight, cross-platform, and single-threaded programming language. It's an interpreted language that executes code line by line, providing more flexibility.JavaScript on Client Side: On the client side, Jav
11 min read
Web Development Web development is the process of creating, building, and maintaining websites and web applications. It involves everything from web design to programming and database management. Web development is generally divided into three core areas: Frontend Development, Backend Development, and Full Stack De
5 min read
React Interview Questions and Answers React is an efficient, flexible, and open-source JavaScript library that allows developers to create simple, fast, and scalable web applications. Jordan Walke, a software engineer who was working for Facebook, created React. Developers with a JavaScript background can easily develop web applications
15+ min read
React Tutorial React is a powerful JavaScript library for building fast, scalable front-end applications. Created by Facebook, it's known for its component-based structure, single-page applications (SPAs), and virtual DOM,enabling efficient UI updates and a seamless user experience.Note: The latest stable version
7 min read
JavaScript Interview Questions and Answers JavaScript is the most used programming language for developing websites, web servers, mobile applications, and many other platforms. In Both Front-end and Back-end Interviews, JavaScript was asked, and its difficulty depends upon the on your profile and company. Here, we compiled 70+ JS Interview q
15+ min read
Domain Name System (DNS) DNS is a hierarchical and distributed naming system that translates domain names into IP addresses. When you type a domain name like www.geeksforgeeks.org into your browser, DNS ensures that the request reaches the correct server by resolving the domain to its corresponding IP address.Without DNS, w
8 min read
HTML Interview Questions and Answers HTML (HyperText Markup Language) is the foundational language for creating web pages and web applications. Whether you're a fresher or an experienced professional, preparing for an HTML interview requires a solid understanding of both basic and advanced concepts. Below is a curated list of 50+ HTML
14 min read
NodeJS Interview Questions and Answers NodeJS is one of the most popular runtime environments, known for its efficiency, scalability, and ability to handle asynchronous operations. It is built on Chromeâs V8 JavaScript engine for executing JavaScript code outside of a browser. It is extensively used by top companies such as LinkedIn, Net
15+ min read
Top 10 Projects For Beginners To Practice HTML and CSS Skills Learning to code is an exciting journey, especially when stepping into the world of programming with HTML and CSSâthe foundation of every website you see today. For most beginners, these two building blocks are the perfect starting point to explore the creative side of web development, designing vis
8 min read
Web Development Technologies Web development refers to building, creating, and maintaining websites. It includes aspects such as web design, web publishing, web programming, and database management. It is the creation of an application that works over the internet, i.e., websites.To better understand the foundation of web devel
7 min read