secondsky/claude-skills / plugins/nuxt-seo/skills/nuxt-seo
nuxt-seo
VerifiedNuxt SEO v5 modules (robots, sitemap, og-image, schema-org, link-checker, seo-utils, site-config). Use when implementing SEO, robots.txt, sitemaps, Schema.org, or meta tags in Nuxt apps.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 10.6 KB |
| assets/package-versions.json | config | 3.6 KB |
| references/advanced-configuration.md | markdown | 9.0 KB |
| references/advanced-seo-guides.md | markdown | 18.8 KB |
| references/ai-seo-tools.md | markdown | 10.9 KB |
| references/api-reference.md | markdown | 10.2 KB |
| references/best-practices.md | markdown | 5.4 KB |
| references/common-patterns.md | markdown | 12.7 KB |
| references/installation-guide.md | markdown | 7.2 KB |
| references/module-details.md | markdown | 14.2 KB |
| references/modules-overview.md | markdown | 9.6 KB |
| references/nitro-api-reference.md | markdown | 14.2 KB |
| references/nuxt-content-integration.md | markdown | 14.4 KB |
| references/og-image-guide.md | markdown | 13.5 KB |
| references/pro-modules.md | markdown | 6.8 KB |
| references/seo-guides.md | markdown | 24.7 KB |
| references/sitemap-advanced.md | markdown | 16.3 KB |
| references/troubleshooting.md | markdown | 5.7 KB |
| references/v5-migration-guide.md | markdown | 8.5 KB |
| scripts/init-nuxt-seo.shexecutable | script | 7.0 KB |
scripts/init-nuxt-seo.sh
View on GitHub#!/usr/bin/env bash
#
# Nuxt SEO Quick Setup Script
# Automatically sets up all 8 Nuxt SEO modules in a Nuxt project
#
# Usage: ./init-nuxt-seo.sh
#
set -euo pipefail
# Script-global CONFIG_FILE: tracked by the cleanup trap so the sed .tmp
# tempfile never leaks even on early exit / failure. Populated in
# create_config() and reset to "" once sed completes successfully.
CONFIG_FILE=""
cleanup_sed_tmp() {
if [ -n "${CONFIG_FILE:-}" ] && [ -f "${CONFIG_FILE}.tmp" ]; then
rm -f "${CONFIG_FILE}.tmp"
fi
}
trap cleanup_sed_tmp EXIT
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Print functions
print_header() {
echo -e "${BLUE}========================================${NC}"
echo -e "${BLUE} Nuxt SEO Setup${NC}"
echo -e "${BLUE}========================================${NC}"
}
print_success() {
echo -e "${GREEN}β${NC} $1"
}
print_error() {
echo -e "${RED}β${NC} $1"
}
print_info() {
echo -e "${YELLOW}β${NC} $1"
}
# Check if we're in a Nuxt project
check_nuxt_project() {
if [ ! -f "nuxt.config.ts" ] && [ ! -f "nuxt.config.js" ]; then
print_error "Not a Nuxt project (nuxt.config.ts/js not found)"
echo ""
echo "Create a new Nuxt project first:"
echo " bunx nuxi@latest init my-project"
echo " cd my-project"
echo " ./path/to/init-nuxt-seo.sh"
exit 1
fi
}
# Detect package manager
detect_package_manager() {
if command -v bun &> /dev/null; then
echo "bun"
elif command -v pnpm &> /dev/null; then
echo "pnpm"
elif command -v npm &> /dev/null; then
echo "npm"
else
print_error "No package manager found (bun, pnpm, or npm required)"
exit 1
fi
}
# Install Nuxt SEO modules
install_modules() {
local pm=$1
print_info "Installing @nuxtjs/seo (all 8 modules)..."
case $pm in
bun)
bunx nuxi module add @nuxtjs/seo
;;
pnpm)
pnpm dlx nuxi module add @nuxtjs/seo
;;
npm)
npx nuxi module add @nuxtjs/seo
;;
esac
print_success "@nuxtjs/seo installed"
}
# Create basic configuration
create_config() {
print_info "Creating basic SEO configuration..."
# Check if nuxt.config.ts exists
if [ -f "nuxt.config.ts" ]; then
CONFIG_FILE="nuxt.config.ts"
else
CONFIG_FILE="nuxt.config.js"
fi
# Backup existing config
cp "$CONFIG_FILE" "${CONFIG_FILE}.backup"
print_info "Backed up existing config to ${CONFIG_FILE}.backup"
# Check if modules array exists and add if needed. The cleanup trap
# installed above guarantees ${CONFIG_FILE}.tmp is removed even on
# sed failure or early exit; we no longer rely on `&& rm` chaining,
# which would leak the tempfile on non-zero exit.
if grep -q "modules:" "$CONFIG_FILE"; then
# Add to existing modules array
sed -i.tmp "s|modules: \[|modules: ['@nuxtjs/seo', |" "$CONFIG_FILE"
rm -f "${CONFIG_FILE}.tmp"
else
# Add modules array to config
sed -i.tmp "s|export default defineNuxtConfig({|export default defineNuxtConfig({\n modules: ['@nuxtjs/seo'],|" "$CONFIG_FILE"
rm -f "${CONFIG_FILE}.tmp"
fi
# Add site config if not exists
if ! grep -q "site:" "$CONFIG_FILE"; then
cat >> "$CONFIG_FILE" << 'EOF'
// SEO Configuration
site: {
url: process.env.NUXT_PUBLIC_SITE_URL || 'http://localhost:3000',
name: 'My Awesome Site',
description: 'Building amazing web experiences',
defaultLocale: 'en'
}
EOF
fi
print_success "Configuration created"
}
# Create .env.example
create_env_example() {
print_info "Creating .env.example..."
cat > .env.example << 'EOF'
# Nuxt SEO Configuration
NUXT_PUBLIC_SITE_URL=https://example.com
NUXT_PUBLIC_SITE_NAME=My Awesome Site
NUXT_PUBLIC_ENV=production
EOF
print_success ".env.example created"
}
# Create example OG image component
create_og_component() {
print_info "Creating example OG image component..."
mkdir -p components
cat > components/OgImage.vue << 'EOF'
<template>
<div class="w-[1200px] h-[630px] flex flex-col justify-between p-16 bg-gradient-to-br from-blue-600 to-purple-700">
<div class="flex items-center justify-between">
<div class="text-2xl text-white/80">{{ siteName }}</div>
</div>
<div class="flex-1 flex items-center">
<div>
<h1 class="text-7xl font-bold text-white mb-6 leading-tight">
{{ title }}
</h1>
<p v-if="description" class="text-3xl text-white/90">
{{ description }}
</p>
</div>
</div>
<div class="text-white/70 text-xl">
{{ new Date().toLocaleDateString() }}
</div>
</div>
</template>
<script setup>
defineProps({
title: String,
description: String,
siteName: String
})
</script>
EOF
print_success "OG image component created (components/OgImage.vue)"
}
# Create example sitemap endpoint
create_sitemap_example() {
print_info "Creating example sitemap endpoint..."
mkdir -p server/api/__sitemap__
cat > server/api/__sitemap__/example.ts << 'EOF'
export default defineSitemapEventHandler(async () => {
// Example: Fetch dynamic content
// const items = await $fetch('/api/items')
// Return sitemap entries
return [
{
loc: '/about',
lastmod: new Date(),
changefreq: 'monthly',
priority: 0.8
}
]
// Dynamic example:
// return items.map(item => ({
// loc: `/items/${item.slug}`,
// lastmod: item.updatedAt,
// changefreq: 'weekly',
// priority: 0.9
// }))
})
EOF
print_success "Sitemap example created (server/api/__sitemap__/example.ts)"
}
# Print next steps
print_next_steps() {
echo ""
echo -e "${GREEN}========================================${NC}"
echo -e "${GREEN} Setup Complete! π${NC}"
echo -e "${GREEN}========================================${NC}"
echo ""
echo "Next steps:"
echo ""
echo "1. Update environment variables:"
echo " cp .env.example .env"
echo " # Edit .env with your site URL"
echo ""
echo "2. Start dev server:"
echo " bun run dev"
echo " # or: npm run dev"
echo ""
echo "3. Verify SEO setup:"
echo " β’ Visit http://localhost:3000/robots.txt"
echo " β’ Visit http://localhost:3000/sitemap.xml"
echo ""
echo "4. Customize configuration in nuxt.config.ts"
echo ""
echo "Documentation:"
echo " https://nuxtseo.com"
echo ""
}
# Main execution
main() {
print_header
echo ""
# Check if in Nuxt project
check_nuxt_project
# Detect package manager
PM=$(detect_package_manager)
print_info "Using package manager: $PM"
echo ""
# Install modules
install_modules "$PM"
# Create configuration
create_config
# Create .env.example
create_env_example
# Create OG component
create_og_component
# Create sitemap example
create_sitemap_example
# Print next steps
print_next_steps
}
# Run main function
main
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |