It's a well-known fact, but it bears repeating - SEO is important. With billions of Google searches made daily, it's certainly beneficial to capture a piece of that pie for your website.

In this article, I'll guide you through optimizing your Nuxt websites for SEO, with a focus on Nuxt 3. However, the principles here can be applied to any framework.

Ready? Let's begin.

Why Is SEO So Important?

Search engine optimization, or SEO, involves optimizing your website's content and setup to boost its presence in search engine rankings.

Organic searches play a HUGE role in introducing people to your brand, and that's one of the reasons why creating SEO-friendly websites is so important.

There are different ways to approach SEO: on-page, off-page, and the technical side of things. For this article, I'll focus on the technical side, especially since Nuxt has some great modules and features that can help with that.

Optimizing SEO with Nuxt

Setting Page Title and Meta Description

Well-written page titles and meta descriptions are CRUCIAL for SEO.

When a user visits your webpage, the title is the first impression they get. It should clearly and concisely communicate the content of the page. The same goes for meta description.

An example of page titles and descriptions
An example of page titles and descriptions

Remember, these titles and descriptions influence the click-through rate (CTR), making them vital for driving traffic. They should be unique for each page.

In Nuxt 3, you can set page titles and meta descriptions in various ways.

One simple method is the useHead composable, where you can define the title and meta within a specific page file:

<script setup lang="ts">
  title: 'How to Make Sure Your Nuxt Website Is SEO-Optimized?',
  meta: [
    { name: 'description', content: 'Meta description...' }


Alternatively, you can use Title and Meta components inside the Head component.

<script setup lang="ts">
const title = ref('How to Make Sure Your Nuxt Website Is SEO-Optimized?')

const description = ref('Meta description..')

      <Title>{{ title }}</Title>
      <Meta name="description" :content="description" />
These components mirror native HTML elements (like <title> or <head>), so it's crucial to capitalize them in the template.

Lastly, there's the useSeoMeta composable. While both useHead and useSeoMeta can set titles and descriptions, useSeoMeta is the most recommended method. That's because it's XSS-safe and fully supports TypeScript.

<script setup lang="ts">
  title: 'How to Make Sure Your Nuxt Website Is SEO-Optimized?',
  description: 'Meta description...',

Open Graph Meta Tags

We've talked about meta descriptions, but there's more to SEO than just that. Other essential elements like OG tags also deserve our attention.

"OG" is short for Open Graph, a protocol designed to turn web pages into rich, interactive objects within a social graph.

If someone enjoys what they read on your site, they may want to share it with others. By incorporating OG tags, you can streamline this sharing process and ensure your content appears at its best on social platforms.

More than just making content look good, OG tags give social media platforms like Facebook a clearer picture of the content, enhancing the chance it gets shown to the right audience.

<script setup lang="ts">
  title: '...',
  ogTitle: 'Your Open Graph Title Here',
  description: '...',
  ogDescription: 'Your Open Graph Description Here',
  ogImage: 'Your Open Graph Image URL Here',

In the provided example, we've set both the title and description as we typically would. However, we've also added some Open Graph tags.

The description is the snippet that is displayed on the SERP (Search Engine Results Page), giving users a brief overview of what the page contains.

On the other hand, ogDescription is tailored to how the content appears when shared on social media platforms. And the ogImage provides a visual representation of your content, as it specifies an image URL to be showcased within the social graph.

There are numerous other open graph protocol tags available. For a comprehensive list, you can refer to the link provided below:

Open Graph protocol
The Open Graph protocol enables any web page to become a rich object in a social graph.


A sitemap is a file that lists all the different pages, videos, and other files, along with how they relate to one another. Search engines, like Google, use sitemaps to crawl websites more effectively.

Though Google suggests that as long as your site's pages are interlinked properly, most of your content will be discovered by search engine crawlers, having a sitemap is still beneficial. Even if not strictly necessary, there's no harm in having one – better safe than sorry.

For example, here's how a sitemap, automatically generated by Ghost, looks for my website:

XML Sitemap for my blog
XML Sitemap for my blog

Now, if you're wondering about creating a sitemap for a Nuxt project, there's a dedicated module for that. It's designed to seamlessly integrate a sitemap into your project.

GitHub - harlan-zw/nuxt-simple-sitemap: Powerfully flexible XML Sitemaps that integrate seamlessly, for Nuxt.
Powerfully flexible XML Sitemaps that integrate seamlessly, for Nuxt. - GitHub - harlan-zw/nuxt-simple-sitemap: Powerfully flexible XML Sitemaps that integrate seamlessly, for Nuxt.

Setting it up is very easy: simply install the module and add it to your Nuxt configuration file.

export default defineNuxtConfig({
  modules: ['nuxt-simple-sitemap']

The best thing about this module is its flexibility. You can create multiple sitemaps for varied sections of your site or even tweak their UI.


The robots.txt file is another important element to consider for SEO.

Do you absolutely need one? According to Google's documentation, when Googlebot visits a website, it first checks the robots.txt file to ask for permission to crawl. If a site lacks a robots.txt file, robots meta tag, or X-Robots-Tag HTTP headers, it's typically crawled and indexed as usual.

You'd primarily want a robots.txt file if you want to have more control over the crawling process. With robots.txt, you can specify pages that you don't want search engines to crawl, ensuring they don't appear in search results.

For those using Nuxt, there's a convenient module available to easily generate a robots.txt file.

Install Nuxt Simple Robots · Nuxt SEO
Get started with nuxt-simple-robots by installing the dependency to your project.


Images play a significant role in SEO, and there's enough to say that they could deserve their own article. For now, let's touch on a few key tips:

  1. Descriptive Names: Avoid generic filenames like qwertyyuiop.png. Instead, use the descriptive ones like white-chair-in-the-office.png.
  2. Optimize Images: Compress images and, if possible, use the webp format. The goal is to minimize the file size without compromising quality. A faster website translates to a better user experience, which can boost your SEO.
  3. Alt Attributes: The primary purpose of alt text is to enhance accessibility for those who can't view images. However, it's also an SEO improvement. That's because Google combines alt text, algorithms, and page content to better understand an image's context.
  4. Lazy Loading: Use the loading attribute to ensure off-screen images load only when users scroll to them, enhancing site performance.

Now, when the image is relevant to your content, rely on HTML image elements, like img or picture. Google won't index CSS images, so they're best used for design aspects unrelated to content.

<img src="white-chair-in-the-office.webp" alt="A white chair in the office" />

This approach is SEO-friendly.

<div style="background-image:url(white-chair-in-the-office.webp)">A white chair in the office</div>

This isn't optimal for SEO but works for purely design-centric uses.

Links, like images, have vast implications in SEO. While there are many important concepts like internal linking, I'll focus on two aspects relevant to optimizing your Nuxt site: descriptive anchor texts and the rel attribute.

  1. Descriptive Anchor Texts: As the term indicates, using detailed and informative anchor texts can benefit both users and search engines. Instead of non-specific phrases like "click here" or "learn more", try to be more precise. This not only improves user experience but also provides search engines with clearer context about the link's content.
  2. Rel Attribute: This little attribute informs search engines about the nature and intent of a link. For instance, if you don't want Google to associate your site with a linked page or crawl it, use the nofollow value:
<a href="..." rel="nofollow">Some other website</a>

There are other rel values, too, but most situations might not require anything out of the ordinary. Still, it's beneficial to understand the distinction between dofollow and nofollow links and be aware of other variants.

If you're looking to deep dive into the outbound links and their impact on SEO, I'd suggest exploring more on the topic. The document below provides a detailed insight into various link types and how they influence SEO.

Qualify Outbound Links for SEO | Google Search Central | Documentation | Google for Developers
You might want to tell Google your relationship with outbound links on your site. Discover how to qualify outbound links with rel attribute values.

Proper URL Structure

Having the right URL structure is more important than it might seem at first glance. There are plenty of articles with URLs that are a mile long, stuffed with the full title, dates, and even random numbers. However, this is not the best way to handle that.

Try to keep your URLs simple and descriptive. For example, is much more appealing than a lengthy, complicated URL.

Also, remember to use hyphens to separate words in URLs. It makes the URL more readable both for search engines and users, so "seo-guide" is more effective than "seo_guide" or "seoguide".

Complicated URLs, especially if they have several parameters, can be a crawler's nightmare. They might end up indexing numerous URLs that all lead to the same content on your site. This might prevent some of your site's content from being indexed.

The takeaway - keep your URLs clear, concise, and descriptive. It's beneficial for both users and search engines.

Proper HTTP Status Codes and 404 Page

HTTP status codes are three-digit responses from the server, indicating whether a browser's request was successful or encountered an error.

Ensuring the correct status codes are sent is essential for search engines like Google. For example, a 200 status code indicates a successful page load, signaling to search engines that everything is working as expected.

One way to ensure proper management of these codes is by creating a custom error page using an error.vue file in the root directory. This custom page will be shown whenever Nuxt encounters a fatal error. Just remember - this isn't a regular route and should be kept separate from the ~/pages directory.

The error page comes with an error prop that offers comprehensive details about the error. Using fields like url, statusCode, statusMessage, message, description, and data from the error object, you can display relevant error messages to users.

For example, if the error indicates a 404 status, you can show an appropriate "404 Page not Found" message.

301 Redirects

You can also use redirects to handle HTTP status codes. Redirects, especially 301 (Permanent Redirect), play a vital role in SEO. A 301 redirect ensures that the link equity from an old URL is passed on to the new URL.

Implementing a 301 redirect is recommended when:

  • A page has been deleted, and there's another relevant page you'd like to redirect users to.
  • You've modified the URL of an already published page.
  • You're altering your URL structure, like removing the 'www' prefix.

How do you create a redirect in Nuxt? Middleware is one option, but another effective way is using routeRules within the Nuxt configuration like this:

export default defineNuxtConfig({
  routeRules: {
    '/some-old-page': { redirect: { to:'/new-page', statusCode: 301 } }

Page Speed and Mobile Optimization

Wrapping things up, we need to address page speed and mobile optimization. Remember, a smooth user experience translates to better SEO and can impact your site's ranking.

If your website isn't mobile-friendly or takes too long to load, users might not stay, regardless of the quality of your content.

While I've touched upon image optimization, there's more to improving site performance. Consider actions like:

  • Minimizing unnecessary JavaScript.
  • Streamlining the execution time of your JavaScript.
  • Reducing large data transfers that can slow down page loading.

This area is vast, and going into detail on these topics would take us away from our main focus on Nuxt's technical SEO. But it's important to note that page speed is not just an extra feature; it's essential for good SEO.

Other Types of SEO to Remember

This article mostly concentrated on the technical aspects of SEO. That means we didn't really talk about on-page and off-page SEO strategies, both of which are equally important.

While a strong foundation in technical SEO is essential, you can't neglect other facets of SEO. This includes creating valuable content, optimizing internal linking, maintaining a clear heading hierarchy, and much more.

In conclusion, I'd also recommend diving deeper into other SEO strategies to ensure that all your efforts deliver the best results.

Final Words

That's a wrap! We've gone through some essential technical SEO aspects to keep in mind while developing with Nuxt.js.

I trust that this guide has equipped you with the knowledge to make your Nuxt site more SEO-friendly.

If you have any questions or feedback about this article, please don't hesitate to get in touch through the contact form.

Thank you for taking the time to read this.

Best of luck on your SEO journey!

Sources 🔗:

Table of Contents
Great! Next, complete checkout for full access to Kajetan Domagała.
Welcome back! You've successfully signed in.
You've successfully subscribed to Kajetan Domagała.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info has been updated.
Your billing was not updated.