Skip to content

Vue and Nuxt SEO: make Vue pages readable to crawlers

Vue SEO for AI search: why a default Vue SPA sends an empty shell, how Nuxt rendering modes and useHead change the HTML, and how to check the result.

By Crawlito · 9 min read

In short

  • A Vue app that renders only in the browser sends one HTML file with an empty mount element, so a crawler that does not run JavaScript reads no page text and the same title on every route.
  • Nuxt renders pages on the server by default, so the response already contains the full HTML; setting ssr to false turns that off, and Nuxt's own docs warn that crawlers won't wait for the interface to be fully rendered on their first try.
  • Nuxt route rules let you prerender marketing pages, cache blog pages and keep an admin area client-only, but hybrid rendering is not available with nuxt generate.
  • Titles, meta tags and canonical links set with useHead only reach crawlers that do not run JavaScript when the page is rendered on the server or prerendered.
  • Verify each route with a plain HTTP request: the response should contain its own title, canonical link, main text and links without running any script.
On this page

A Vue single-page app that renders in the browser sends crawlers an empty HTML shell, and a crawler that does not run JavaScript reads no page text from it. Nuxt avoids this by default because it renders pages on the server. The risk is a Nuxt site with ssr: false, or a plain Vue app, where the text and the per-page title only exist after a script runs. This guide shows how to check which one you have and how to choose between SPA, prerendering and server rendering for each route.

Fixing this makes your pages readable. It does not make them rank or get cited. Whether a search tool uses a page depends on many things outside your build.

Why a default Vue SPA ships an empty shell

A browser-rendered Vue app mounts into one element. The HTML the server sends is that element plus a script tag. This is a typical Vite build output (illustrative; your file names will differ):

html
<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>Acme</title>
    <script type="module" crossorigin src="/assets/index-a1b2c3.js"></script>
  </head>
  <body>
    <div id="app"></div>
  </body>
</html>

With the usual single-page-app rewrite rule, the host returns this same file for /, /pricing and /blog/first-post. Every route has the same title and no text until the bundle runs.

Google can cope with that to a degree. Its JavaScript SEO basics describe three phases (crawling, rendering and indexing) and say pages with a 200 status go into a render queue that can take longer than a few seconds. The same page also says that "not all bots can run JavaScript," which is why it recommends server-side rendering or pre-rendering.

The Vue SSR guide makes the same point from the framework side. Google and Bing can index synchronous JavaScript apps, it says, but if your app starts with a loading spinner and then fetches content, the crawler will not wait for it, and SSR might be necessary for those pages.

For AI crawlers the evidence is thinner. In Vercel and MERJ's December 2024 analysis, the crawlers from OpenAI, Anthropic, Meta, ByteDance and Perplexity did not execute JavaScript. The same analysis found that Gemini, which uses Google's infrastructure, and Applebot did render it. That is one network at one time, so treat it as a snapshot. Do AI crawlers run JavaScript? covers what each operator documents. The safe plan is to put what matters in the server's HTML.

How to check what your Vue or Nuxt page sends in the raw HTML

Fetch a few routes without a browser and compare the titles. If every route returns the same title, you have a shell.

bash
for route in / /pricing /blog/first-post; do
  echo "== $route"
  curl -s "https://example.com$route" | grep -o '<title>[^<]*</title>'
  curl -s "https://example.com$route" | grep -io '<link[^>]*canonical[^>]*>'
done

Then search for a sentence you can see on the page:

bash
curl -s https://example.com/pricing | grep -c "Plans start at"

A count of 0 means that sentence is not in the HTML the server sent. Do not use the browser's Elements panel for this, because it shows the page after scripts ran. Use view-source: or curl. How to see your page as an AI crawler, with curl adds user agents and a word-count script.

Nuxt rendering modes: universal SSR, static, hybrid and SPA

Nuxt's rendering concepts page lists the modes. At the time of writing, they work like this.

ModeHow you get itWhat the crawler receives
Universal rendering (SSR)The defaultThe server runs the Vue code and returns a fully rendered HTML page
Static generationnuxt generate or nuxt build --prerenderOne static HTML file per page by default
HybridrouteRules per route groupWhatever each rule says: prerendered, cached or client-only
Client-side (SPA)ssr: falseA shell; the browser builds the interface from JavaScript

Nuxt says universal rendering "delivers the entire HTML content" to the browser, so crawlers can index content directly, and the browser then hydrates the page. The trade-offs it lists are that server and browser environments don't provide the same APIs, which constrains shared code, and that a server has to run to render pages on the fly.

SPA mode is one config line:

ts
export default defineNuxtConfig({
  ssr: false,
})

The same page lists simpler development and cheaper static hosting as benefits, and names the drawback for search: crawlers won't wait for the interface to be fully rendered on their first try, so indexing and updates are slower. If a Nuxt site looks empty in your curl test, check for this setting first.

Hybrid rendering with route rules

You rarely need one mode for the whole site. Route rules set rendering or caching per route group. This example is a trimmed version of the one in the Nuxt docs:

ts
export default defineNuxtConfig({
  routeRules: {
    '/': { prerender: true },
    '/products/**': { swr: 3600 },
    '/blog/**': { isr: true },
    '/admin/**': { ssr: false },
  },
})

Here prerender: true builds the page at build time as a static asset, swr caches the server response for a set time, isr behaves the same except that the response can also go into the CDN cache, on platforms that support it (Nuxt currently names Netlify and Vercel), and ssr: false renders that section only in the browser. A client-only admin area is a sensible use of that last rule: no crawler needs to read it.

One limit to know about: Nuxt says hybrid rendering is not available with nuxt generate, so check that your build command and hosting support the rules you plan to use. For the general trade-offs between these approaches, see SSR vs CSR for SEO and AI search.

Per-route titles, meta and canonical tags with useHead

Rendering on the server is only half the job. Each route also needs its own title, description and canonical URL in the HTML head. Nuxt's useHead manages the head, powered by Unhead, and accepts a title, meta entries that become <meta> tags, and link entries that become <link> tags.

vue
<script setup lang="ts">
const route = useRoute()

useHead({
  title: 'Pricing',
  meta: [
    { name: 'description', content: 'Plans, limits and what each one includes.' },
  ],
  link: [
    { rel: 'canonical', href: `https://example.com${route.path}` },
  ],
})
</script>

The useHead page does not show a canonical example, but it says each link item maps to a <link> tag with its properties as attributes, which is what the snippet above uses. Nuxt's SEO and meta guide also documents useSeoMeta, a typed flat-object alternative for meta tags, and titleTemplate for a shared suffix. The template can be a string with %s or a function; the guide says a function cannot be set in nuxt.config, so put it in app.vue.

Three things to check:

  • Tags must be in the server response. Nuxt's useSeoMeta page notes that search robots primarily scan the initial page load, and that static tags can be wrapped in import.meta.server so they are added only during server-side rendering. In SPA mode there is no server step, so the shared <title> is what a non-rendering crawler gets.
  • Set the canonical in HTML. Google says the best way to set the canonical URL is HTML. If you inject one with JavaScript it must match the original, and only one canonical tag should exist after rendering. Canonical tags and duplicate URLs covers the rules.
  • Do not rely on JavaScript to remove noindex. Google says it may skip rendering when it sees noindex, so removing it with a script may not work.

Keeping client-only components from hiding content

Server rendering can still hide text if the content you care about sits in the wrong place. Two Nuxt features cause this most.

<ClientOnly>. Per Nuxt's docs, it renders its content only in the browser, and the default slot content is left out of the server build. What the server renders instead is the fallback you provide:

vue
<ClientOnly fallback-tag="span" fallback="Loading comments...">
  <CommentsWidget />
</ClientOnly>

That is fine for a comments widget. It is wrong for a product description or a pricing table.

Data fetching. Nuxt's data fetching guide says useFetch and useAsyncData run on the server, resolve before the page is serialized, and pass their data to the browser in the payload. That means the HTML is populated. Setting server: false runs the call only in the browser, so the initial server HTML has no data for it. A plain $fetch in setup can fetch twice, once on the server and once on the client.

Use useFetch or useAsyncData for anything a crawler should read, and keep server: false for data that is not needed on first render.

Prerendering a small Vue SPA as a stopgap

If you have a Vite SPA and cannot move to Nuxt yet, prerender the public routes at build time. The Vue SSR guide says that if you are looking at SSR only to improve SEO for a handful of marketing pages such as /, /about and /contact, you probably want static site generation instead of SSR. It also says static generation only suits pages whose data is known at build time.

One tool for this is vite-ssg, described in its README as static-site generation for Vue 3 on Vite. Per the README, you install vite-ssg, vue-router and @unhead/vue, change the build script to vite-ssg build, and export createApp from ViteSSG(App, { routes }, setupFn) in src/main.ts. Head tags still come from useHead, now imported from @unhead/vue, and an includedRoutes hook, set in ssgOptions, controls which paths are rendered. The README lists a double payload as a downside.

A prerender service that serves snapshots only to crawlers by user agent is a different approach, with its own risks and bot-list gaps; prerendering for crawlers covers it. Whichever route you pick, SPA error pages need care. Google notes that client-side routing can make real status codes hard, and suggests redirecting to a URL that returns a real 404 or adding noindex to error pages.

How to verify the result for AI crawlers

  1. Run the curl loop from earlier on your five most important routes. Each should return its own title, its canonical link and the sentence you searched for.
  2. Compare with a browser. Pick a sentence from a data-driven section, such as a price or a product list, and confirm it is in the raw HTML. This is where server: false and <ClientOnly> show up.
  3. Check links. The raw HTML should contain <a href> links to your other pages, not buttons that navigate with scripts. Google says it can only discover links that are <a> elements with an href.
  4. Check status codes. A missing route should return a 404, not a 200 shell.
  5. Look at your logs. If you want evidence of who fetches what, measuring AI crawler traffic is the next step. This post does not cover it.

Sending a crawler's user agent with curl shows what user-agent rules serve. It cannot reproduce firewall rules that check IP addresses.

Frequently asked questions

Do I need Nuxt for Vue SEO?

Not always. The Vue docs recommend a framework only if you need SSR, and say a handful of marketing pages may be better served by static generation. If your public pages change often or depend on request-time data, a server-rendering framework such as Nuxt is the more direct fix.

Does Google index a Vue SPA?

Google processes JavaScript apps in a crawl, render and index flow, so it can. Its documentation also says rendering can wait in a queue and that not all bots run JavaScript, so Google indexing a page tells you nothing about other crawlers.

Does ssr: false hurt SEO in Nuxt?

Nuxt's docs say crawlers won't wait for the interface to be fully rendered on their first try, so indexing and updates are slower. For public pages, prefer the default or a prerender route rule.

Where should the canonical tag go?

In the HTML head, rendered on the server. Google says HTML is the best place, and any canonical you set with JavaScript must match the one in the original HTML.

Do AI crawlers read Nuxt sites?

If the page is server rendered, the content is in the response and a crawler that does not run JavaScript can read it. Whether a given assistant then uses the page is outside your control.

Check your own pages

The free check fetches one page the way AI crawlers do, with no account, and reports whether the main text is in the raw HTML. Run it on your pricing page and one data-driven page first. If the problem spans many routes, an audit runs the checks across up to 500 pages.

Filed under Rendering and content. Topics: vue, nuxt, javascript, ssr, rendering, ai-crawlers