How to Optimize SEO for a GitHub Pages Blog (Sitemap, JSON-LD, og:image)
Home > Tutorial > How to Optimize SEO for a GitHub Pages Blog (Sitemap, JSON-LD, og:image)
Archive
- Installing Apache, MySQL, PHP, and phpMyAdmin on Arch Linux 2021
- Configuring an Apache Virtual Host on Arch Linux Jun 12, 2021
- How to Deploy a Static Blog to GitHub Pages Nov 17, 2026
- How to Sign Up for make.fun with an Agent and Let the Agent Find Bounties on Its Own Nov 17, 2026
- How to Hunt Bug Bounties with Agentic-Bug-Hunter Nov 18, 2026
- How to Install Google Analytics 4 and Tag Manager on a Static Blog Nov 26, 2026
- How to Optimize SEO for a GitHub Pages Blog (Sitemap, JSON-LD, og:image) Nov 26, 2026
- How to Join make.fun Bounties with an AI Agent Nov 26, 2026
- How to Build a Tank Bot on battle.training Nov 26, 2026
- How to Make a Bootable Ventoy USB Nov 26, 2026
- How to Mint Free NFTs on BSC Safely Nov 30, 2026
- How to Make Automated Story YouTube Shorts (Stickman + TTS) Nov 30, 2026
Your blog is live on GitHub Pages, but try searching for it on Google — it might not show up. For Google to find, read, and display your blog in search results, there are a few basics to set up. They're all free, need no server, and only have to be done once. Here's the checklist.
Figure 1: A 9-point SEO checklist for a GitHub Pages blog.
1. Sitemap.xml — A List of All Pages
sitemap.xml is a list of all the pages on your blog, complete with the date each was last modified (lastmod). Google reads this file to discover new pages on your blog. Create a sitemap.xml file in the repository root, then add one <url> block for each page:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://kodename-jpg.github.io/</loc>
<lastmod>2026-11-26</lastmod>
</url>
<url>
<loc>https://kodename-jpg.github.io/tutorial.html</loc>
<lastmod>2026-11-26</lastmod>
</url>
</urlset>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://kodename-jpg.github.io/</loc>
<lastmod>2026-11-26</lastmod>
</url>
<url>
<loc>https://kodename-jpg.github.io/tutorial.html</loc>
<lastmod>2026-11-26</lastmod>
</url>
</urlset>
Every time you add a new page, add another
<url> block, and update lastmod whenever a page's content changes.
Tip: A sitemap doesn't guarantee a page gets indexed right away — it only helps Google find your pages. Indexing still takes time.
2. robots.txt — Tell Google Which Pages It May Read
robots.txt tells search engines which pages they may read. Place this file in the repository root, next to sitemap.xml:
User-agent: *
Allow: /
Sitemap: https://kodename-jpg.github.io/sitemap.xml
Allow: /
Sitemap: https://kodename-jpg.github.io/sitemap.xml
Allow: / means all pages may be read, and the Sitemap: line points to your sitemap's location so Google can find it right away.
3. Canonical — One Official URL per Page
The
canonical tag tells Google which URL is the official one for a page. This matters when one page can be opened through several addresses — without a canonical, Google may treat them as different pages. Place it inside the <head> of each page, using an absolute URL (complete with the https:// domain):
<link rel="canonical" href="https://kodename-jpg.github.io/nama-halaman.html">
4. A Unique Meta Description for Each Page
A
meta description is a 120–160 character summary that appears under the title in search results. Each page needs its own description explaining what that page is about — don't copy and paste it from another page:
<meta name="description" content="An SEO checklist for a static blog on GitHub Pages: sitemap, robots.txt, canonical, JSON-LD, and a 1200x630 share image.">
Warning: Don't use the same description on every page — Google may treat those pages as duplicates of each other.
5. JSON-LD BlogPosting — Structured Data
JSON-LD is structured data that helps Google understand your page: this is an article, this is its title, this is its author, this is its publication date. Place it inside
<head>, using the BlogPosting type from schema.org:
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "BlogPosting",
"headline": "Judul Tutorial",
"description": "Ringkasan isi tutorial.",
"datePublished": "2026-11-26",
"author": {
"@type": "Person",
"name": "Febriyan"
}
}
</script>
{
"@context": "https://schema.org",
"@type": "BlogPosting",
"headline": "Judul Tutorial",
"description": "Ringkasan isi tutorial.",
"datePublished": "2026-11-26",
"author": {
"@type": "Person",
"name": "Febriyan"
}
}
</script>
Dates use the
YYYY-MM-DD format. Once it's in place, check the result in Google's Rich Results Test — if something is wrong, the tool will show you the problematic line.
6. Open Graph — An Appealing Share Preview
When a blog link is shared on WhatsApp, Facebook, or Telegram, its appearance comes from the Open Graph tags. Without
og:image, the preview is plain with no image — and people are less likely to click. Add these tags inside <head>:
<meta property="og:title" content="Judul Tutorial — Kodename JPG">
<meta property="og:description" content="Ringkasan isi tutorial.">
<meta property="og:image" content="https://kodename-jpg.github.io/img/og-image.jpg">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta property="og:image:alt" content="Kodename JPG — Tutorial Linux, Web & AI Agent">
<meta property="og:description" content="Ringkasan isi tutorial.">
<meta property="og:image" content="https://kodename-jpg.github.io/img/og-image.jpg">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta property="og:image:alt" content="Kodename JPG — Tutorial Linux, Web & AI Agent">
The ideal share image is 1200 × 630 pixels (a 1.91:1 ratio), in JPG or PNG format. One image for all pages is enough; if you want, each article can use its own image.
Figure 2: The 1200 × 630 share image size and an example preview when a link is shared.
Tip: Twitter Card (
twitter:card) is optional — Open Graph is enough for previews in most apps. This blog doesn't use Twitter tags at all.
7. One H1 and a Correct Heading Hierarchy
Each page should have just one
<h1> — the page's main title. Its sections use <h2>, and sub-sections use <h3>. Don't jump from h1 straight to h3, and don't use h2 just to make text bigger — if you want big text, set it through CSS.
Warning: More than one H1 on a page makes it hard for Google to determine that page's main topic.
8. Alt Text on All Images
Alt text describes an image for readers whose images don't load, and for Google, which can't "see" images. Write it short and specific about what's in the image:
<img src="img/diagram-seo-checklist.svg" alt="Checklist 9 poin SEO untuk blog GitHub Pages">
If an image is purely decorative,
alt may be left empty (alt=""), but tutorial images should always have alt text.
9. Root-Relative Internal Links
Links between pages on the blog should be root-relative: starting with a slash from the domain root, for example
href="/en/tutorial.html". Links like this stay correct even if the page is moved to another folder:
<a href="/tutorial.html">Tutorial</a>
Avoid relative links like
href="tutorial.html" when your page is in a subfolder — the link can break.
How to Submit Your Sitemap to Google Search Console
To help Google find your sitemap quickly, submit it directly through Google Search Console (free):
1. Open search.google.com/search-console and sign in with your Google account.
2. Add a property with your blog's address, for example
kodename-jpg.github.io.
3. Verify ownership — upload the verification HTML file or paste the meta tag Google gives you.
4. Open the Sitemaps menu, enter
sitemap.xml, then click Submit.
5. Wait for Google to read your sitemap.
How to Check the Results
In Search Console, open the Performance menu. There you'll find
impressions (how many times your blog appeared in search results), clicks (how many times it was clicked), and average position (its average position in search results). Also check the Pages menu to see which pages are already indexed and which aren't yet.
It takes a few days to weeks for pages to get indexed — a 0 in the first week is normal. What matters is that the numbers slowly rise over time.
Tip: Don't panic if the first week is still 0 — Google needs time to crawl and index a new site. While waiting, keep adding content.
Common Mistakes
- The same meta description on every page.
- No canonical — Google guesses each page's official URL on its own.
- Images without alt text.
- More than one H1 on a page.
- The sitemap isn't updated after adding a new page.
References
- Google Search Central — SEO Starter Guide
- Google Search Central — Build and submit a sitemap
- Schema.org — BlogPosting
Like this tutorial? Support the author so there are more free tutorials.
Support via Saweria
Comments