Enable The Google Search

Updated:

Introduction

The result of a Github blog is not searched if it is left alone. If you search by site tag to fix the blog address, it will not be searched at all. To be searched on Google, you must register the blog on Google search console. This article describes how to register a Github blog on Search console.

Updated (2024.07)

I moved to a blog that is self-deployed through my own domain on Github. Therefore, I registered Google search on the following method using the domain. At this time, it is required to reflect the txt record to DNS, but I use a domain from dotname, so I added the txt record through the DNS record management window on the website.

You need to modify the url in _config.yml to the current domain.

Domain? URL?

Google search console

When you access Google search console, you will see a window like the above. Since we do not buy a domain from DNS, we must use the right method. When using the right method, you can use the following method.

  • HTML 파일 : Upload an HTML file to the website (recommended)
  • HTML 태그 : Add a meta tag to the website homepage
  • Google 애널리틱스 : Use a Google analytics account
  • Google 태그 관리자 : Use a Google tag manager account
  • 도메일 이름 공급업체 ; Connect DNS records and Google

Google recommends uploading an html file, but there is a simpler way to use Jekyll. Let’s look at both methods. There is a simpler way to use Jekyll. Let’s look at both methods.

HTML File upload

First, let’s try the method of using an HTML file. When you press the check button after entering the site path, upload the file like google********.html provided to the path where the _config.yml file is located.

Jekyll config

When you scroll down, you will see various other methods, and select HTML tag and insert the content part of the meta tag into the following part of _config.yml.

# SEO Related
google_site_verification :

Sitemap.yml and robots.txt

This part has a plugin that automatically creates a sitemap file in Jekyll. However, this function is not available on Github pages.

# Plugins (previously gems:)
plugins:
  - jekyll-paginate
  - jekyll-sitemap
  - jekyll-gist
  - jekyll-feed
  - jekyll-include-cache

Therefore, you need to put the following file directly in the root directory. It is important to correctly write the location and name of sitemap.xml in robots.txt.

---
layout: null
---

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"
                xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
    {% for post in site.posts %}
    <url>
        <loc>{{ site.url }}{{ post.url }}</loc>
        {% if post.lastmod == null %}
        <lastmod>{{ post.date | date_to_xmlschema }}</lastmod>
        {% else %}
        <lastmod>{{ post.lastmod | date_to_xmlschema }}</lastmod>
        {% endif %}

        {% if post.sitemap.changefreq == null %}
        <changefreq>weekly</changefreq>
        {% else %}
        <changefreq>{{ post.sitemap.changefreq }}</changefreq>
        {% endif %}

        {% if post.sitemap.priority == null %}
        <priority>0.5</priority>
        {% else %}
        <priority>{{ post.sitemap.priority }}</priority>
        {% endif %}

    </url>
    {% endfor %}
</urlset>
User-agent: *
Allow: /

Sitemap: ../sitemap.yml

register sitemap

Now, register the sitemap file to Google search console.

Sitemap

Result

You cannot search the site immediately. It may take a week or a month, so wait patiently. Then, you can search as follows.

Search Result

Tags:

Categories:

Updated: