Skip to content

Adding Basic SEO to the Website

Since this is a public website, it should probably have at least some SEO. I asked Codex to evaluate the basics, and this is the list it came up with:

sitemap.xml

This is a site map for search engines. It tells them which official pages exist on the website.

  • VitePress 1.6.4 can generate this file with its built-in sitemap feature. It scans the site structure during the build and creates the file automatically, so there is no need to maintain it by hand.
  • The sitemap URL and exclusion rules are configured in the sitemap section of .vitepress/config.mts. The root redirect page and Tag pages are excluded.
  • The root language redirect page is not included in the search index.
  • Tag pages are not indexed for now because they do not contain much content yet.

robots.txt

This is basically a sign at the door. It tells search engines that they can read the site and points them to the sitemap.

BlogPosting

BlogPosting is structured article data for search engines. It includes the title, description, author, date, language, preview image, and canonical URL, making the article's basic information easier to identify.

canonical URL

  • Canonical URLs are added to official pages, with https://inn666.dev used as the official domain.
  • This tells search engines to treat different URLs for the same page as one URL, preventing search ranking signals from being split between them.

hreflang and language settings

  • Pages with matching Chinese and English versions include hreflang language tags.
  • Articles without a translation do not generate links to a language version that does not exist.

Icons and preview images

  • Open Graph / Twitter Card: preview information and images used when sharing links.
  • favicon / Apple Touch Icon: icons used in browser tabs and on device home screens.

SEO keywords

I am not planning to compete hard for exposure yet, so I am not setting up any special SEO keywords or changing article content for SEO.

Google Search Console

Finally, the site is verified in Google Search Console and the sitemap is submitted to help Google discover it. Whether and when the site is indexed is still up to Google.

Getting closer to the top of the search results would take more work, but I am leaving that part out for now.

Conclusion

The settings are basically kept together in config.mts and robots.txt, so every article on the site can load the same basic configuration while filling in its own details from the article data.

English translation provided by Codex.