Automatically translated.View original post

Verify identity. Webside with Google.

# Web Site Writing Basics # googlescript # Trending # google_ search _ console

Adopting the Vite + React project on Vercel to the Google Search Console for Google to read and display on the search results page. There is a detailed procedure:

Step 1: Add a website to the Google Search Console.

Go to Google Search Console and Login with Gmail.

Click "Add property" (Add property)

There will be two options:

Domain: (Must be set at domain provider such as Cloudflare, GoDaddy)

URL prefix: (Recommended for newbies or users using the .vercel.app domain) Enter the full URL of your web, such as https://my-project.vercel.app, and press Continue

Step 2: Ownership Verification

The easiest way for a React project is to use HTML Tag.

On the Google Search Console page, select the HTML Tag method.

Copy code that looks like this:

< meta name = "google-site-verification" content = "numeric and alphabetical code" / >

Go back to the Vite project on your machine.

Open the index.html file (located at the project's Root)

Place the copied code in the < head > section... < / head >

HTML

< head >

< meta charset = "UTF-8" / >

< meta name = "viewport" content = "width = device-width, initial-scale = 1.0" / >

< meta name = "google-site-verification" content = "your code" / >

< title > Your web name < / title >

< / head >

Save then git commit and git push up GitHub to allow Vercel to re-deploy

Step 3: Press Verify in the Google Search Console.

When Vercel Deploy is done (try opening the page to see if there is meta code yet by pressing Ctrl + U).

Return to the Google Search Console page and press the "Verify" button.

If correct, the system says "Ownership verified."

Step 4: Making Sitemap (to let Google recognize all pages)

Since React is a Single Page Application (SPA), we should create a Sitemap to tell Google which pages it has.

Create a simple Sitemap file: Create a file named sitemap.xml in the public folder of the Vite project.

Enter this code (change the URL to yours):

XML

< urlset xmlns = "http://www.sitemaps.org/schemas/sitemap/0.9" >

< url >

< loc > https://your-project.vercel.app / < / lock >

< lastmod > 2023-10-27 < / lastmod >

< / url >

< url >

< loc > https://your-project.vercel.app/about < / lock >

< lastmod > 2023-10-27 < / lastmod >

< / url >

< / urlset >

Push the job up, Vercel again.

In Google Search Console, go to the Sitemaps menu on the left.

Enter the word sitemap.xml in the "Add a new sitemap" box and press Submit.

Step 5: Doing More SEO (Very Important for React)

Vite + React is normally Client-Side Rendering (CSR), which Google might be invisible to content if Metadata isn't set up for good:

Enter Title and Description: In the index.html file, check that these tags are available:

HTML

< title > Web name that you want to show on Google < / title >

< meta name = "description" content = "Brief description of your website (about 150-160 characters)" >

Use React Helmet (Recommended): To have each page named (Title) not the same, install React-helmet-async to manage Metadata on each Component.

Last step: Ask Google to store data (URL Inspection)

If you want Google to know the web, you immediately (don't queue):

Go to the inspection URL in Search Console

Paste your web URL into the search box above.

If it says "URL is not on Google," press the "Request Index" button.

Note: After completing all the steps, Google may take from one day to two weeks to start rendering the page.

3/24 Edited to

... Read moreเมื่อคุณสร้างเว็บด้วย Vite + React และโฮสต์บน Vercel การยืนยันตัวตนกับ Google Search Console เป็นสิ่งสำคัญเพื่อให้ Google เข้าใจและระบุเว็บไซต์ของคุณอย่างถูกต้อง สำหรับตัวผมเอง การทำตามขั้นตอนแบบละเอียดที่อธิบายในบทความนี้ช่วยให้การจัดการเว็บไซต์เป็นระบบมากขึ้น โดยเฉพาะการใช้ Meta tag ในไฟล์ index.html เพื่อยืนยันตัวตนง่ายและรวดเร็ว รวมถึงการสร้าง sitemap.xml ซึ่งช่วยให้ Google รู้จักและเก็บข้อมูลทุกหน้าของเว็บไซต์ได้ครบถ้วน แม้ว่า React จะเป็น SPA (Single Page Application) ก็ตาม ประสบการณ์ตรงคือ การติดตั้ง react-helmet-async เพื่อจัดการ Title และ Description ในแต่ละหน้า ทำให้ SEO ประสิทธิภาพดีขึ้นมาก เพราะแต่ละหน้าสามารถมีข้อมูลอธิบายเฉพาะตัวที่แตกต่างกันได้ ซึ่งส่งผลให้การแสดงผลในหน้าค้นหาเหมาะสมและดึงดูดผู้ใช้งานมากขึ้น อีกเทคนิคที่อยากแชร์คือ การใช้เมนู URL Inspection ใน Google Search Console เพื่อส่งคำขอให้ Google ทำการ indexing หน้าเว็บทันที ไม่ต้องรอคิวตามปกติ ซึ่งสะดวกมากเมื่อเราอัปเดตเว็บหรือเพิ่มเนื้อหาใหม่ๆ อย่างไรก็ดี การจะเห็นผลลัพธ์ของการยืนยันและการจัดอันดับบน Google อาจต้องใช้เวลาตั้งแต่ 1 วันจนถึง 2 สัปดาห์ จึงต้องใจเย็นและตรวจสอบสถานะใน Search Console เป็นระยะ สุดท้ายนี้ การตั้งค่า SEO และยืนยันตัวตนเว็บกับ Google ไม่ใช่เรื่องยากหากเข้าใจขั้นตอนและใช้เครื่องมือให้ถูกวิธี ขอแนะนำให้ทุกคนลองทำตาม พร้อมประเมินผลและปรับแต่งอย่างสม่ำเสมอ เพื่อให้เว็บของคุณแสดงผลได้ดีในผลการค้นหาและช่วยเสริมสร้างยอดผู้เข้าชมอย่างยั่งยืน