Vue.js / Nuxt.js

SEO with Nuxt

Meta tags, useHead, useSeoMeta, structured data, sitemaps, robots.txt, Open Graph, social sharing

20 interview questions·
Senior
1

What is the main difference between useHead and useSeoMeta in Nuxt?

Answer

useHead is a generic composable for managing all HTML head tags (title, script, link, style, meta), while useSeoMeta is specialized only for SEO meta tags with strict TypeScript typing. useSeoMeta offers better type safety and automatic validation of SEO properties like og:image, twitter:card, while useHead requires manual meta tag configuration. Prefer useSeoMeta for SEO metadata and useHead for other head elements.

2

What is a canonical tag and why is it important for SEO?

Answer

The canonical tag (rel=canonical) tells search engines which is the primary version of a page when multiple URLs have similar or identical content. It prevents duplicate content penalty and consolidates PageRank to the canonical URL. In Nuxt, the canonical tag is automatically generated by default for each page, pointing to the current URL. It can be disabled or customized via useSeoMeta with canonical: false or a specific URL. Essential for sites with pagination, filters, or multilingual versions.

3

How to disable indexing of a specific page in Nuxt while allowing crawling?

Answer

Using useSeoMeta with robots: 'noindex, follow' allows crawlers to visit the page and follow links, but prevents indexing in search results. This approach is preferable to robots.txt for already indexed pages, as robots.txt blocks crawling but doesn't remove pages from the index. Alternative: use defineRouteRules with robots: 'noindex' for centralized configuration. To completely block crawling, robots.txt with Disallow is necessary but less flexible per page.

4

What are the essential Open Graph properties for good social sharing?

5

How to generate a dynamic sitemap in Nuxt from an external API?

+17 interview questions

Master Vue.js / Nuxt.js for your next interview

Access all questions, flashcards, technical tests, code review exercises and interview simulators.

Start for free