How to set a page title in Nuxt
In this tutorial, we are going to learn about how to set a page title for the current page in nuxt.
Consider, we have an about
page in our nuxt app and we need to set a title to it.
Setting the page title
To set a page title for the current page, we can use the head()
method in nuxt application.
Note: Nuxt uses vue-meta package to update the html head tags.
Example:
about.vue
<template>
<div>
<h1>This is the About page</h1>
</div>
</template>
<script>
export default {
head() {
return {
title: "About page" };
},
};
</script>