惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 三生石上(FineUI控件)
Martin Fowler
Martin Fowler
月光博客
月光博客
AI
AI
B
Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
C
CXSECURITY Database RSS Feed - CXSecurity.com
WordPress大学
WordPress大学
GbyAI
GbyAI
L
Lohrmann on Cybersecurity
O
OpenAI News
Schneier on Security
Schneier on Security
P
Palo Alto Networks Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
Troy Hunt's Blog
V2EX - 技术
V2EX - 技术
W
WeLiveSecurity
L
LINUX DO - 最新话题
人人都是产品经理
人人都是产品经理
S
Security Affairs
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
A
Arctic Wolf
Recorded Future
Recorded Future
Microsoft Security Blog
Microsoft Security Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
G
GRAHAM CLULEY
N
Netflix TechBlog - Medium
TaoSecurity Blog
TaoSecurity Blog
C
Check Point Blog
Scott Helme
Scott Helme
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Apple Machine Learning Research
Apple Machine Learning Research
PCI Perspectives
PCI Perspectives
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Vercel News
Vercel News
The Hacker News
The Hacker News
Y
Y Combinator Blog
Latest news
Latest news
SecWiki News
SecWiki News
Hugging Face - Blog
Hugging Face - Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Google Online Security Blog
Google Online Security Blog
Webroot Blog
Webroot Blog
Google DeepMind News
Google DeepMind News
Recent Commits to openclaw:main
Recent Commits to openclaw:main
C
Cisco Blogs
博客园_首页
H
Hackread – Cybersecurity News, Data Breaches, AI and More
宝玉的分享
宝玉的分享
L
LINUX DO - 热门话题

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
Vue.js SPA SEO: how I made my app invisible to Google (and how I fixed it)
Odilon HUGON · 2026-05-18 · via DEV Community

I spent three months building CitoyenNote — a Vue.js 3 + Vite SPA. Clean code, Composition API, composables for everything, Pinia for state management. The kind of codebase you're actually proud of. Then I typed the site name into Google and got back a single result: the homepage. With a title of "Document". No description. And none of the 80+ municipality pages were indexed.

That's the SPA SEO problem in a nutshell. Here's what I learned fixing it.

What Google actually sees in a SPA

A classic server-rendered page serves complete HTML on the first request. Google's crawler receives a full <head> with a title, meta description, canonical URL — everything it needs to index the page.

A Vue.js SPA in CSR mode serves this on every URL:

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Document</title>
  </head>
  <body>
    <div id="app"></div>
    <script type="module" src="/assets/index-Bx9kLmQp.js"></script>
  </body>
</html>

Enter fullscreen mode Exit fullscreen mode

Google's crawler does execute JavaScript — but with significant caveats: it uses an older Chromium version, JS rendering is deferred and lower priority than HTML crawling, and there's no guarantee of complete execution on every page. Relying on JS execution for SEO is a gamble. The fix is to give Google correct HTML right from the start.

The full solution requires six steps.

Step 1: get the index.html basics right

The static index.html at the root of your Vite project is the baseline every page will fall back to when JavaScript hasn't run yet. It should be respectable:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <title>CitoyenNote — Citizen reviews of French municipalities</title>
    <meta name="description" content="Read and share ratings and reviews about your municipality: safety, schools, public transport, urban planning. Unfiltered citizen feedback." />

    <!-- Open Graph -->
    <meta property="og:type" content="website" />
    <meta property="og:title" content="CitoyenNote — Citizen reviews of French municipalities" />
    <meta property="og:description" content="Read and share ratings and reviews about your municipality: safety, schools, public transport, urban planning." />
    <meta property="og:url" content="https://citoyennote.fr/" />
    <meta property="og:image" content="https://citoyennote.fr/og-image.jpg" />
    <meta property="og:locale" content="en_US" />

    <!-- Twitter Card -->
    <meta name="twitter:card" content="summary_large_image" />
    <meta name="twitter:title" content="CitoyenNote — Citizen reviews of French municipalities" />
    <meta name="twitter:description" content="Read and share ratings and reviews about your municipality." />
    <meta name="twitter:image" content="https://citoyennote.fr/og-image.jpg" />

    <link rel="canonical" href="https://citoyennote.fr/" />
  </head>
  <body>
    <div id="app"></div>
    <script type="module" src="/src/main.ts"></script>
  </body>
</html>

Enter fullscreen mode Exit fullscreen mode

This static fallback is what social media crawlers (Twitter, LinkedIn, Slack) will read when sharing your homepage — they rarely execute JavaScript.

Step 2: @unhead/vue for dynamic meta tags

For every route to have its own title and meta description, you need a library that manipulates the <head> reactively as the route changes. The current standard for Vue 3 is @unhead/vue, which replaces the older vue-meta.

Installation

npm install @unhead/vue

Enter fullscreen mode Exit fullscreen mode

Setup in main.ts

import { createApp } from 'vue'
import { createHead } from '@unhead/vue'
import App from './App.vue'
import router from './router'

const app = createApp(App)
const head = createHead()

app.use(router)
app.use(head)
app.mount('#app')

Enter fullscreen mode Exit fullscreen mode

Usage in a component

The simplest approach: call useHead() in each page component, with computed values that react to async data loading.

// views/MunicipalityView.vue
<script setup lang="ts">
import { computed } from 'vue'
import { useHead } from '@unhead/vue'
import { useMunicipality } from '@/composables/useMunicipality'

const props = defineProps<{ slug: string }>()
const { municipality, loading } = useMunicipality(props.slug)

useHead({
  title: computed(() =>
    municipality.value
      ? `${municipality.value.name} — CitoyenNote`
      : 'Loading... — CitoyenNote'
  ),
  meta: [
    {
      name: 'description',
      content: computed(() =>
        municipality.value
          ? `Citizen reviews of ${municipality.value.name} (${municipality.value.department}): overall score ${municipality.value.score}/10, ${municipality.value.reviewCount} reviews.`
          : 'Municipality reviews on CitoyenNote.'
      ),
    },
    {
      property: 'og:title',
      content: computed(() =>
        municipality.value ? `${municipality.value.name} — CitoyenNote` : 'CitoyenNote'
      ),
    },
    {
      property: 'og:description',
      content: computed(() =>
        municipality.value
          ? `Citizen reviews of ${municipality.value.name}: overall score ${municipality.value.score}/10.`
          : ''
      ),
    },
    {
      property: 'og:url',
      content: computed(() =>
        `https://citoyennote.fr/municipality/${props.slug}`
      ),
    },
    {
      property: 'og:type',
      content: 'article',
    },
  ],
  link: [
    {
      rel: 'canonical',
      href: computed(() => `https://citoyennote.fr/municipality/${props.slug}`),
    },
  ],
})
</script>

Enter fullscreen mode Exit fullscreen mode

The key point: the values are computed(), so they update automatically when municipality.value is populated after the API call. No need to manually call anything when data arrives.

Extract into a composable

If you have many page types, avoid duplicating useHead() calls. Extract into a typed composable:

// composables/useMunicipalitySeo.ts
import { computed, type Ref } from 'vue'
import { useHead } from '@unhead/vue'
import type { Municipality } from '@/types'

export function useMunicipalitySeo(
  municipality: Ref<Municipality | null>,
  slug: string
) {
  useHead({
    title: computed(() =>
      municipality.value
        ? `${municipality.value.name} — CitoyenNote`
        : 'CitoyenNote'
    ),
    meta: [
      {
        name: 'description',
        content: computed(() =>
          municipality.value
            ? `Citizen reviews of ${municipality.value.name}: score ${municipality.value.score}/10, ${municipality.value.reviewCount} reviews.`
            : ''
        ),
      },
      {
        property: 'og:title',
        content: computed(() =>
          municipality.value ? `${municipality.value.name} — CitoyenNote` : 'CitoyenNote'
        ),
      },
      {
        property: 'og:url',
        content: `https://citoyennote.fr/municipality/${slug}`,
      },
    ],
    link: [{ rel: 'canonical', href: `https://citoyennote.fr/municipality/${slug}` }],
  })
}

Enter fullscreen mode Exit fullscreen mode

Usage in the component becomes a single line:

useMunicipalitySeo(municipality, props.slug)

Enter fullscreen mode Exit fullscreen mode

Step 3: robots.txt

Place a robots.txt at the root of your public/ folder — Vite will copy it as-is to the build output:

User-agent: *
Allow: /

Sitemap: https://citoyennote.fr/sitemap.xml

Enter fullscreen mode Exit fullscreen mode

If parts of your app shouldn't be indexed (admin panels, user dashboards, private routes), block them explicitly:

User-agent: *
Disallow: /admin/
Disallow: /dashboard/
Disallow: /settings/
Allow: /

Sitemap: https://citoyennote.fr/sitemap.xml

Enter fullscreen mode Exit fullscreen mode

Step 4: dynamic sitemap

A static sitemap only covers routes you know at build time. For a content-heavy app with thousands of municipality pages, the sitemap must be generated dynamically from the database.

In CitoyenNote's case, the backend is a Go API (Echo framework). I added a dedicated /sitemap.xml route:

// routes/sitemap.go
package routes

import (
    "encoding/xml"
    "net/http"
    "time"

    "github.com/labstack/echo/v4"
    "citoyennote/internal/repository"
)

type URLSet struct {
    XMLName xml.Name `xml:"urlset"`
    Xmlns   string   `xml:"xmlns,attr"`
    URLs    []URL    `xml:"url"`
}

type URL struct {
    Loc        string  `xml:"loc"`
    LastMod    string  `xml:"lastmod,omitempty"`
    ChangeFreq string  `xml:"changefreq,omitempty"`
    Priority   float64 `xml:"priority,omitempty"`
}

func SitemapHandler(repo repository.MunicipalityRepository) echo.HandlerFunc {
    return func(c echo.Context) error {
        municipalities, err := repo.ListAll(c.Request().Context())
        if err != nil {
            return err
        }

        urlset := URLSet{
            Xmlns: "http://www.sitemaps.org/schemas/sitemap/0.9",
        }

        // Static routes
        urlset.URLs = append(urlset.URLs,
            URL{Loc: "https://citoyennote.fr/", Priority: 1.0, ChangeFreq: "daily"},
            URL{Loc: "https://citoyennote.fr/search", Priority: 0.8, ChangeFreq: "weekly"},
        )

        // Dynamic municipality pages
        for _, m := range municipalities {
            urlset.URLs = append(urlset.URLs, URL{
                Loc:        "https://citoyennote.fr/municipality/" + m.Slug,
                LastMod:    m.UpdatedAt.Format(time.DateOnly),
                ChangeFreq: "weekly",
                Priority:   0.7,
            })
        }

        c.Response().Header().Set("Content-Type", "application/xml; charset=UTF-8")
        return xml.NewEncoder(c.Response()).Encode(urlset)
    }
}

Enter fullscreen mode Exit fullscreen mode

No build step, no caching needed for this size. For a site with 100,000+ pages, consider splitting into a sitemap index and multiple sub-sitemaps (Google's limit is 50,000 URLs per sitemap file).

Submit the sitemap URL in Google Search Console and verify it parses correctly.

Step 5: JSON-LD structured data

JSON-LD is Google's preferred format for Schema.org structured data. It goes in a <script type="application/ld+json"> tag in the <head>. @unhead/vue handles this cleanly:

// Add to useMunicipalitySeo.ts
useHead({
  // ... existing title/meta config ...
  script: [
    {
      type: 'application/ld+json',
      innerHTML: computed(() => {
        if (!municipality.value) return ''

        return JSON.stringify({
          '@context': 'https://schema.org',
          '@type': 'Place',
          name: municipality.value.name,
          description: `Citizen reviews of ${municipality.value.name}.`,
          url: `https://citoyennote.fr/municipality/${slug}`,
          aggregateRating: {
            '@type': 'AggregateRating',
            ratingValue: municipality.value.score,
            reviewCount: municipality.value.reviewCount,
            bestRating: 10,
            worstRating: 0,
          },
        })
      }),
    },
  ],
})

Enter fullscreen mode Exit fullscreen mode

The AggregateRating type is what enables star ratings to appear directly in Google search results (rich snippets). Not guaranteed, but Google does pick it up reliably for well-structured pages with enough reviews.

For a blog or article, use @type: "BlogPosting" with datePublished, dateModified, and author. For a product, use @type: "Product". The Google structured data gallery lists all types that qualify for rich results.

Step 6: the 404 route

A SPA with client-side routing needs a server-level fallback. Without it, directly navigating to /municipality/paris returns a real 404 from the server before Vue even loads. Google interprets that as a 404 and won't index the page.

The fix depends on your hosting. On Apache:

# .htaccess at the root of your SPA
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /

  # Don't rewrite real files and directories
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d

  # Everything else goes to index.html
  RewriteRule ^ index.html [L]
</IfModule>

Enter fullscreen mode Exit fullscreen mode

On Nginx:

location / {
    try_files $uri $uri/ /index.html;
}

Enter fullscreen mode Exit fullscreen mode

On Vite's dev server, this works automatically. On production, it's on you.

Inside Vue Router, add a catch-all route that returns a proper 404 UI — and critically, set the HTTP status code. With SSR or prerendering this is straightforward. With pure CSR, the HTTP response for a non-existent route is always 200 (the server returns index.html). Google handles this gracefully for most cases, but it's worth knowing.

// router/index.ts
const routes = [
  // ... your routes ...
  {
    path: '/:pathMatch(.*)*',
    name: 'NotFound',
    component: () => import('@/views/NotFoundView.vue'),
  },
]

Enter fullscreen mode Exit fullscreen mode

The honest limitation: CSR vs SSR

All of the above makes a CSR SPA considerably more Google-friendly. But there's a ceiling.

Google's crawler does execute JavaScript, but it does so in a second wave, hours or days after the initial crawl. The initial crawl reads raw HTML. So what Google sees first is your static index.html — the same fallback on every URL — with no route-specific content.

If your site depends on search visibility for hundreds or thousands of distinct pages (municipality pages, product pages, article pages), you have two real options:

  • SSR (Server-Side Rendering): Nuxt 3 for Vue.js. The server renders the full HTML for each request. Google gets the right HTML immediately. The cost: a Node.js server, more complex infrastructure, hydration to manage.
  • SSG (Static Site Generation): Nuxt or VitePress can pre-render all routes at build time to static HTML files. Perfect for content that doesn't change per-user. The cost: dynamic content (user-specific data, real-time scores) needs hydration after the static shell loads.

For CitoyenNote, I stayed with CSR + the fixes above because the content (municipality scores, reviews) changes frequently and Google does eventually index the JavaScript-rendered pages correctly. The SEO improvement from the fixes was significant: 80+ pages indexed within two weeks of the sitemap submission, versus zero before.

If I were starting again from scratch on a project where SEO is the primary acquisition channel, I'd go with Nuxt 3 from day one.

SEO checklist for Vue.js SPAs

A summary you can run through before launching:

  • index.html: complete <head> with charset, viewport, default title, meta description, Open Graph tags, Twitter Card, canonical URL
  • @unhead/vue: installed, registered in main.ts, useHead() called in every page component with computed reactive values
  • Canonical URLs: set on every page, including the homepage
  • robots.txt: present in public/, includes Sitemap: directive
  • Sitemap: all indexable URLs listed, dynamic pages included, submitted to Google Search Console
  • JSON-LD: relevant schema type on key pages (Place, Product, BlogPosting, Organization...)
  • Server fallback: .htaccess or Nginx config routes all paths to index.html
  • 404 route: catch-all route defined in Vue Router
  • Google Search Console: sitemap submitted, URL inspection run on a sample of key pages, coverage report checked after 2 weeks
  • Social sharing test: Facebook Debugger and Twitter Card Validator on at least 3 URLs (homepage, a content page, a 404)

None of this is particularly complicated. The painful part is discovering three months into a project that you forgot to do it. The checklist exists so you don't have to rediscover it the hard way.