DEV Community

Cover image for How I make my site searchable in 2 minutes
Technophile
Technophile

Posted on

How I make my site searchable in 2 minutes

Your site will not magically show up on Google unless you help search engines to find it.

So, let’s fix that.

Basic SEO

First things first, in your HTML, add these lines of code in the <head> tag:

<title>My Awesome Site</title>
<meta name="description" content="This summarizes serves as an example. Use this wisely.">
<meta name="keywords" content="coding, youtube">
<meta name="author" content="Your Name">
Enter fullscreen mode Exit fullscreen mode

This helps Google understand your content better, plus that's what it shows in Google search page when you look it up.

Google search result

Next, if someone shares your site on Discord, Twitter, or LinkedIn — these control how it looks.

Add these lines as well.

<meta property="og:title" content="My Awesome Site" />
<meta property="og:description" content="Check out this cool project I built!" />
<meta property="og:image" content="https://yourdomain.com/preview.png" />
<meta property="og:url" content="https://yourdomain.com" />
<meta property="og:type" content="website" />
Enter fullscreen mode Exit fullscreen mode

While, they're not mandatory, who doesn't like extra SEO boost, right?

Sharing site in Discord

Now, add a basic favicon so your site looks legit in tabs:

<link rel="icon" href="/favicon.ico" />
Enter fullscreen mode Exit fullscreen mode

Also, without one, sites often don't look authentic.

Website favicon close-up

And, lastly, add this line to ensure your site doesn't break on phones, because without it Google will dock points for it.

<meta name="viewport" content="width=device-width, initial-scale=1.0">
Enter fullscreen mode Exit fullscreen mode

Advanced SEO

That's pretty much it, but if you want go an extra mile, we can generate a sitemap and add it to Google Search console.

If you're using Vite, install this plugin first in the terminal:

npm i vite-plugin-sitemap
Enter fullscreen mode Exit fullscreen mode

Then in your vite.config.js, add these lines:

import Sitemap from 'vite-plugin-sitemap';
plugins: [Sitemap()]
Enter fullscreen mode Exit fullscreen mode

Which, should give you a sitemap.xml at the root. That’s what Google looks for.

Sitemap

Next, go to Google Search console and link your domain. Here, you need to confirm that you actually own your domain. If you're using Namecheap & Netlify to host your website, all you have to do is copy the TXT value provided by Google search console and add it to the Netlify as a new DNS record.

Netlify DNS record

It takes some time for it to take effect, but then your site should be easily searchable with this max level SEO setup.

Video format

Top comments (0)

OSZAR »