Getting indexed on Google is not automatic. Here's a practical guide to verifying ownership and submitting your sitemap correctly, with specific notes for React SPAs.
Step 1 — Add Your Site to Google Search Console
1. Go to [search.google.com/search-console](https://search.google.com/search-console) 2. Click **Add property** → choose **URL prefix** (e.g. `https://yourdomain.com`) 3. Choose a verification method
Step 2 — Choose the Right Verification Method
### HTML File Upload (easiest for static hosts)
Download the `googleXXXXXXXX.html` file from GSC and place it in your `public/` folder:
cp ~/Downloads/google1234567890abcdef.html ./public/For Vite/React projects, `public/` files are copied to `dist/` at build time — so after your next deploy, the URL `yourdomain.com/google1234567890abcdef.html` will be accessible and GSC will verify.
### Meta Tag (for single-page apps)
If you use `react-helmet-async`, add it to your root layout:
<Helmet>
<meta
name="google-site-verification"
content="your_verification_code_here"
/>
</Helmet>Wait for Google to crawl your page (or use the **Verify now** button after deploying).
Step 3 — Generate Your Sitemap
For a Vite + React project, I use a Node.js script:
// generate-sitemap.mjs
import { writeFileSync } from 'fs';
import blog from './src/data/blog.json' assert { type: 'json' };
const BASE = 'https://yourdomain.com';
const staticRoutes = ['', '/about', '/projects', '/services', '/blog', '/contact'];
const blogRoutes = blog.posts.map(p => `/blog/${p.slug}`);
const allRoutes = [...staticRoutes, ...blogRoutes];
const xml = `<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
${allRoutes.map(r => ` <url>
<loc>${BASE}${r}</loc>
<changefreq>${r === '' ? 'weekly' : 'monthly'}</changefreq>
<priority>${r === '' ? '1.0' : '0.8'}</priority>
</url>`).join('\n')}
</urlset>`;
writeFileSync('./public/sitemap.xml', xml);
console.log(`Sitemap generated: ${allRoutes.length} URLs`);Add to `package.json`:
"scripts": {
"generate-sitemap": "node generate-sitemap.mjs",
"build": "npm run generate-sitemap && vite build"
}Step 4 — Add robots.txt
Create `public/robots.txt`:
User-agent: *
Allow: /
Sitemap: https://yourdomain.com/sitemap.xmlStep 5 — Submit in Google Search Console
1. In GSC left sidebar → **Sitemaps** 2. Enter `sitemap.xml` in the field and click **Submit** 3. Status should change from *Pending* to *Success* within a few hours
Step 6 — Request Indexing for Key Pages
Don't wait for Googlebot to crawl. In GSC:
1. Paste your URL in the top search bar (e.g. `https://yourdomain.com`) 2. Click **Request Indexing** 3. Repeat for `/about`, `/projects`, `/services`
Google typically indexes verified pages within 1–3 days.
Common Issues
**"URL is not on Google"** — Check your `robots.txt` isn't blocking `/`. Check your meta robots tag isn't `noindex`.
**"Crawled — currently not indexed"** — Your content may be too thin. Add more unique, valuable content.
**Sitemap returns 404** — Ensure your build step runs `generate-sitemap.mjs` before `vite build`.
Conclusion
Verification is a 10-minute task. The payoff is full visibility into how Google sees your site — crawl errors, index coverage, Core Web Vitals, and search queries. Worth doing on day one of any new project.