Frontend Development

SEO

Search engine optimization with @nuxtjs/seo.

Nuda Kit uses @nuxtjs/seo — a comprehensive SEO module that bundles everything you need for search engine optimization in one package.

What's Included

The @nuxtjs/seo module provides:

Sitemap

Automatically generates an XML sitemap of all your pages.

Robots.txt

Configurable robots.txt to control crawler access.

Meta Tags

Easy management of Open Graph and Twitter card meta tags.

Schema.org

Structured data support for rich search results.

Page Metadata

Setting Title and Description

Use the useHead composable to set page-specific metadata:

<script setup lang="ts">
useHead({
  title: 'Dashboard',
  meta: [
    { 
      name: 'description', 
      content: 'Manage your account and view analytics.' 
    },
  ],
})
</script>

Using useSeoMeta

For a cleaner API, use useSeoMeta:

<script setup lang="ts">
useSeoMeta({
  title: 'Pricing Plans',
  description: 'Choose the plan that fits your needs.',
  ogTitle: 'Pricing Plans - Your SaaS',
  ogDescription: 'Flexible pricing for teams of all sizes.',
  ogImage: '/og/pricing.png',
  twitterCard: 'summary_large_image',
})
</script>

Title Template

Nuda Kit uses a title template defined in app.vue:

<script setup lang="ts">
useHead({
  titleTemplate: 'Nuda Kit - %s',
})
</script>

This means:

  • Page title: Dashboard
  • Browser shows: Nuda Kit - Dashboard

To override the template for a specific page:

<script setup lang="ts">
useHead({
  title: 'Your SaaS Name',
  titleTemplate: '', // Removes the template
})
</script>

Open Graph Tags

Open Graph tags control how your pages appear when shared on social media:

TagPurpose
og:titleTitle shown in social shares
og:descriptionDescription shown in social shares
og:imagePreview image (1200x630px recommended)
og:urlCanonical URL
og:typeContent type (website, article, etc.)

Setting Open Graph Tags

<script setup lang="ts">
useSeoMeta({
  ogTitle: 'Your Page Title',
  ogDescription: 'A compelling description for social sharing.',
  ogImage: 'https://yourdomain.com/og-image.png',
  ogUrl: 'https://yourdomain.com/page',
  ogType: 'website',
})
</script>

Twitter Cards

Twitter uses its own meta tags for rich previews:

<script setup lang="ts">
useSeoMeta({
  twitterCard: 'summary_large_image',
  twitterTitle: 'Your Page Title',
  twitterDescription: 'Description for Twitter.',
  twitterImage: 'https://yourdomain.com/twitter-image.png',
})
</script>

Card Types

TypeDescription
summarySmall square image
summary_large_imageLarge rectangular image
appApp download card
playerVideo/audio player

Site Configuration

Configure global SEO settings in nuxt.config.ts:

export default defineNuxtConfig({
  site: {
    url: 'https://yourdomain.com',
    name: 'Your SaaS Name',
    description: 'Your default meta description.',
    defaultLocale: 'en',
  },
})

These values are used as defaults when page-specific values aren't set.

Sitemap

The sitemap is automatically generated at /sitemap.xml. Configure it in nuxt.config.ts:

export default defineNuxtConfig({
  sitemap: {
    // Exclude certain routes
    exclude: [
      '/app/**',  // Exclude authenticated pages
      '/admin/**',
    ],
    // Add custom URLs
    urls: [
      '/custom-page',
    ],
  },
})
Authenticated pages (like /app/*) are typically excluded from sitemaps since they're not indexable.

Robots.txt

Control search engine crawlers with robots.txt configuration:

export default defineNuxtConfig({
  robots: {
    // Disallow specific paths
    disallow: ['/app/', '/api/'],
    // Allow specific crawlers
    allow: '/',
  },
})

The generated robots.txt will be available at /robots.txt.

Canonical URLs

Prevent duplicate content issues with canonical URLs:

<script setup lang="ts">
useHead({
  link: [
    { rel: 'canonical', href: 'https://yourdomain.com/page' }
  ],
})
</script>

Structured Data (Schema.org)

Add structured data for rich search results:

<script setup lang="ts">
useSchemaOrg([
  defineOrganization({
    name: 'Your Company',
    logo: '/logo.png',
    sameAs: [
      'https://twitter.com/yourcompany',
      'https://linkedin.com/company/yourcompany',
    ],
  }),
])
</script>

Common Schema Types

TypeUse Case
OrganizationCompany information
WebSiteSite-wide search box
ProductProduct pages
FAQPageFAQ sections
ArticleBlog posts
BreadcrumbListBreadcrumb navigation

SEO Best Practices

Titles

  • Keep under 60 characters
  • Include primary keyword
  • Make each page title unique
  • Put important words first

Descriptions

  • Keep between 150-160 characters
  • Include a call to action
  • Make each description unique
  • Include relevant keywords naturally

Images

  • Always include alt text
  • Use descriptive file names
  • Optimize file sizes
  • Use modern formats (WebP)

URLs

  • Use descriptive, readable URLs
  • Use hyphens to separate words
  • Keep URLs short
  • Use lowercase letters

Checking Your SEO

Development

Use browser dev tools to inspect meta tags:

  1. Open DevTools (F12)
  2. Go to Elements tab
  3. Check <head> section for meta tags

Testing Tools

Resources