| | |

GitHub Pages 14 ๐Ÿ“„ Limits, SEO & Performance โ€” Managing size/bandwidth quotas, robots.txt, sitemaps, asset caching, and Core Web Vitals

โฑ๏ธ Estimated read: 13 min | |

GitHub Pages provides a powerful, free hosting environment, but it is not an infinite resource. To maintain a high-quality user experience and protect the underlying infrastructure, GitHub enforces specific usage quotas and architectural constraints. Understanding these limitsโ€”ranging from repository size to monthly bandwidth capsโ€”is the first step toward building a sustainable production site. Beyond mere compliance with quotas, a professional deployment requires a proactive approach to Search Engine Optimization (SEO) and web performance. Because GitHub Pages is a static host, you do not have access to server-side configurations, meaning all optimizations must be handled through file-based strategies, build-time scripts, or edge-layer integrations.

This chapter details the operational boundaries of GitHub Pages and the strategies used to maximize its potential within those constraints. We will cover the specific numerical limits for storage and traffic, the implementation of search engine signals like robots.txt and sitemap.xml, and the technical nuances of optimizing for Googleโ€™s Core Web Vitals. Since you cannot modify the server’s cache headers or compression algorithms directly, we will focus on the “Build-Time Optimization” paradigm, where performance is baked into the assets before they ever reach the deployment branch.

The sections below walk through the specific usage quotas enforced by GitHub, the construction of an SEO-friendly directory structure, and the performance techniques required to achieve sub-second load times. We will also address the critical distinction between hosting on a github.io subdomain versus a custom domain, and how that choice impacts your site’s long-term authority and performance.

Key point: GitHub Pages is optimized for small-to-medium static sites; exceeding its 1GB storage or 100GB bandwidth limits results in soft-limits and potential service throttling, requiring developers to offload large assets to external CDNs.


Why exists

The resource management problem. GitHub Pages is a shared hosting environment used by millions of repositories. Without strict limits on repository size (1GB) and monthly bandwidth (100GB), a small number of high-traffic or asset-heavy sites could degrade the performance of the entire platform for everyone else.

The search visibility challenge. Static sites are often “hidden” from search engines by default if they lack proper metadata. Because there is no server-side logic to generate dynamic headers or redirects, developers must manually provide robots.txt and sitemaps to ensure that crawlers can efficiently index the site’s architecture.

The performance bottleneck. In a static hosting model, the browser’s performance is entirely dependent on the size and delivery of the assets. Since you cannot adjust server-side compression (like Brotli settings) or cache-control headers on the fly, you must optimize the “Origin” (the files in your repo) to be as lean as possible.

The “Standardization” trade-off. GitHub provides a standard set of headers and behaviors to ensure security and reliability (like enforcing HTTPS). However, this standardization means you lose the ability to fine-tune specific performance metrics, forcing a shift in focus toward asset-side optimizations like image webp conversion and CSS purging.

The Core Web Vitals movement. Google now uses performance metrics like Largest Contentful Paint (LCP) and Cumulative Layout Shift (CLS) as ranking factors. Static sites on GitHub Pages are naturally fast, but poor asset management (like unoptimized images or render-blocking scripts) can still lead to poor scores, even on a fast CDN.

The canonical URL dilemma. Sites on GitHub Pages are often accessible via multiple URLs (e.g., user.github.io/repo and www.customdomain.com). This creates “Duplicate Content” issues for SEO. Proper configuration is required to tell search engines which URL is the primary source of truth.


a. Managing Quotas: Size, Bandwidth, and Builds

GitHub enforces three primary limits on Pages sites: Repository Size, Bandwidth, and Build Frequency. The repository size limit is 1GB. This is the total size of the files stored in the branch you are deploying from (usually gh-pages or main). If you include large video files, high-resolution source images, or massive PDF archives, you will quickly hit this wall. The best practice is to store large binaries in an external Object Storage (like AWS S3 or Cloudinary) and link to them, rather than committing them to Git.

The bandwidth limit is 100GB per month. For a documentation site or a personal blog, this is exceptionally generous. However, if your site goes viral or hosts large downloadables, you may receive a notification from GitHub. Bandwidth usage is “soft-limited,” meaning GitHub usually won’t shut you down instantly, but they will reach out to ask you to move to a dedicated host or a CDN like Cloudflare to offload the traffic.

Build limits are capped at 10 builds per hour for some accounts, though GitHub Actions-based deployments are generally limited only by your overall GitHub Actions minutes. If you are using a “Scheduled Rebuild” strategy (as covered in Chapter 13), you must ensure your cron schedule doesn’t trigger so frequently that it consumes all your monthly automation minutes or hits the hourly deployment throttle.

# Check the size of your current deployment branch locally
git checkout gh-pages
du -sh . 
# If this exceeds 500MB, start looking for assets to move to a CDN

Managing these quotas effectively requires a “Slim Deployment” mindset. Every megabyte committed to the gh-pages branch is a megabyte that users must download and a megabyte that counts against your quota. Use .gitignore to ensure source files (like .psd or raw .mov files) never make it into the deployment branch.


b. SEO Fundamentals for Static Sites

SEO on GitHub Pages is primarily driven by three files: robots.txt, sitemap.xml, and the CNAME file. The robots.txt file tells search engine crawlers which parts of your site they are allowed to visit. For a static site, you generally want to allow everything unless you have a “Preview” directory (as discussed in Chapter 11) that you want to keep hidden.

The sitemap.xml is even more critical. It is a roadmap of all your URLs. Without it, a crawler might miss deep links or new pages. If you are using Jekyll, the jekyll-sitemap plugin automates this. If you are using Vite or React, you should use a sitemap generator script at build time.

<!-- sitemap.xml example -->
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://example.com/</loc>
    <lastmod>2023-10-27</lastmod>
    <priority>1.0</priority>
  </url>
</urlset>

The most important SEO factor for GitHub Pages is the Canonical URL. Because GitHub Pages serves your site on username.github.io/project, search engines might index that version instead of your custom domain. To prevent this, you must include a canonical tag in the <head> of every HTML page.

<link rel="canonical" href="https://www.yourdomain.com/current-page/" />

This tells Google: “I know you found this content at the github.io address, but please give the ranking credit to my custom domain.” Additionally, ensure your custom domain is configured in the repository settings, which generates a CNAME file and handles the HTTPS certificate provisioning automatically.


c. Performance and Core Web Vitals

Performance on GitHub Pages is largely a “Client-Side” game. GitHub’s infrastructure uses a global CDN (based on Fastly) to serve your files from the edge, meaning the “Server Response Time” (TTFB) is usually excellent. To achieve high scores in Google’s Core Web Vitals, you must focus on the following:

Largest Contentful Paint (LCP): This is the time it takes for the largest visible element (usually a hero image) to load. To optimize this on GitHub Pages, use modern image formats like .webp and implement fetchpriority="high" on your primary image. Avoid loading large JavaScript bundles before the main content.

Cumulative Layout Shift (CLS): This measures visual stability. If your images don’t have defined height and width attributes, the page will “jump” as they load. Always specify dimensions in your HTML or CSS.

First Input Delay (FID) / Interaction to Next Paint (INP): These measure responsiveness. Since GitHub Pages sites are static, they often excel here unless they are “Hydration Heavy” (e.g., a React app that takes 5 seconds to become interactive).

<!-- Example of a performance-optimized image tag -->
<img 
  src="hero.webp" 
  width="800" 
  height="400" 
  alt="Project Hero" 
  fetchpriority="high"
  loading="eager" 
/>

Asset caching is another area where developers have limited control. GitHub Pages sets a default cache duration (usually 10 minutes). You cannot change this. Therefore, you must use Cache Busting (content hashing). By including a hash in your filenames (e.g., main.a1b2c3.js), you can ensure that when you deploy an update, users immediately get the new version, even if the old version was technically still “cached” by their browser.


Complete Example Session

<!-- ============================================
     PART 1: SEO HEADERS (In your Layout template)
     ============================================ -->
<head>
  <title>High Performance Static Site</title>
  <meta name="description" content="SEO and Performance guide for GitHub Pages">
  <!-- Canonical URL to prevent duplicate content issues -->
  <link rel="canonical" href="https://example.com/guide/" />
</head>

<!-- ============================================
     PART 2: CORE WEB VITALS - IMAGE OPTIMIZATION
     ============================================ -->
<!-- Preloading the LCP image for faster rendering -->
<link rel="preload" as="image" href="/assets/hero.webp" fetchpriority="high">

<!-- ============================================
     PART 3: ROBOTS.TXT (Root of your repo)
     ============================================ -->
<!-- User-agent: *
     Allow: /
     Sitemap: https://example.com/sitemap.xml -->

<!-- ============================================
     PART 4: BUILD SCRIPT FOR SITEMAP (package.json)
     ============================================ -->
<!-- "scripts": {
       "build": "vite build && node ./scripts/generate-sitemap.js"
     } -->

<!-- ============================================
     PART 5: CONTENT HASHING (vite.config.js)
     ============================================ -->
<!-- build: {
       rollupOptions: {
         output: {
           entryFileNames: `[name].[hash].js`,
           chunkFileNames: `[name].[hash].js`,
           assetFileNames: `[name].[hash].[ext]`
         }
       }
     } -->

<!-- ============================================
     PART 6: DEFERRING NON-CRITICAL JS
     ============================================ -->
<script src="analytics.js" defer></script>

<!-- ============================================
     PART 7: PRE-CONNECTING TO CDNs
     ============================================ -->
<link rel="preconnect" href="https://fonts.googleapis.com">

<!-- ============================================
     PART 8: INLINING CRITICAL CSS
     ============================================ -->
<style>
  /* Basic layout CSS here to prevent FOUC (Flash of Unstyled Content) */
  body { margin: 0; font-family: sans-serif; }
</style>

<!-- ============================================
     PART 9: ASSET SIZE MONITORING (GitHub Action)
     ============================================ -->
<!-- - name: Report Bundle Size
       uses: preactjs/compressed-size-action@v2 -->

<!-- ============================================
     PART 10: VERIFYING THE CNAME
     ============================================ -->
<!-- Ensure repo settings show "Your site is live at https://example.com" -->

The steps above create a comprehensive SEO and performance foundation, covering everything from metadata and sitemaps to image priority and asset size monitoring.


Quick Reference

GitHub Pages Quotas

LimitValueEnforcement
Repo Size1 GBHard Limit (Source + Build)
Bandwidth100 GB / MonthSoft Limit (Notification)
Builds10 per hourThrottle (Wait to retry)
File Size100 MBGit Hard Limit (via LFS)

Core Web Vitals Targets

MetricGood TargetFocus Area
LCP< 2.5sImage sizes & Priority
FID / INP< 100msJS Execution Time
CLS< 0.1Explicit Image Dims
TTFB< 0.8sGitHub CDN Efficiency

SEO Checklist

File / TagPurposeLocation
robots.txtCrawler Guidance/ (Root)
sitemap.xmlIndexing Roadmap/ (Root)
rel="canonical"Primary URL signal<head>
CNAMECustom Domain/ (Root)

Best Practices

โœ… Do This:

<!-- Use WebP/AVIF formats for images -->
<img src="photo.webp" alt="Description">                       <!-- โœ… -->

<!-- Specify width and height to prevent layout shifts -->
<img src="logo.png" width="200" height="100">                  <!-- โœ… -->

<!-- Use content hashing for cache busting -->
<script src="app.a1b2c3.js"></script>                          <!-- โœ… -->

<!-- Set canonical tags to your custom domain -->
<link rel="canonical" href="https://mysite.com">               <!-- โœ… -->

โŒ Don’t Do This:

<!-- Don't commit 50MB video files to the repo -->
git add movie.mp4                                              <!-- โŒ -->

<!-- Don't use meta refreshes for permanent redirects -->
<meta http-equiv="refresh" content="0; url=...">               <!-- โŒ -->

<!-- Don't load non-critical scripts in the <head> -->
<script src="heavy-library.js"></script>                       <!-- โŒ -->

<!-- Don't use the default github.io URL for SEO -->
https://user.github.io/repo/                                   <!-- โŒ -->

Common Pitfalls

PitfallWhy It HappensFix
Large Repo SizeCommitting node_modules or build artifactsUse .gitignore for source and separate branches for builds
Broken ImagesIncorrect relative paths in subfolder deploymentsUse root-relative paths (e.g., /assets/)
Duplicate IndexingSearch engines index both .io and custom domainsImplement rel="canonical" tags on all pages
Slow LCPHero images loading with loading="lazy"Use fetchpriority="high" and loading="eager" for hero images
Stale CSS/JSBrowser caches old versions after deployImplement content hashing in your build pipeline

Real-World Examples

1. robots.txt

User-agent: *
Allow: /
Disallow: /private/
Sitemap: https://example.com/sitemap.xml

2. Jekyll Sitemap Plugin

# _config.yml
plugins:
  - jekyll-sitemap

3. Vite Cache Busting

// vite.config.js output setting
entryFileNames: `[name].[hash].js`

4. Canonical Tag

<link rel="canonical" href="https://example.com/about">

5. Fetch Priority

<img src="banner.jpg" fetchpriority="high">

6. Defer Script

<script src="analytics.js" defer></script>

7. Preconnect to Fonts

<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>

8. Image Dimensions

<img src="icon.svg" width="32" height="32">

9. Sitemaps for Single Page Apps

// post-build script: generate-sitemap.js
const sitemap = createSitemap(routes);

10. WebP Conversion

# Convert all JPGs to WebP via CLI before deploy
cwebp image.jpg -o image.webp

Visual

The GitHub Pages Quota Boundary

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ GITHUB PAGES USAGE LIMITS                                 โ”‚
โ”‚                                                           โ”‚
โ”‚  [ REPOSITORY ] <โ”€โ”€ 1.0 GB MAX โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”‚
โ”‚    โ”œโ”€โ”€ Source Code                                  โ”‚     โ”‚
โ”‚    โ”œโ”€โ”€ Build Artifacts                              โ”‚     โ”‚
โ”‚    โ””โ”€โ”€ [ LARGE BINARIES ] โ”€โ”€โ”€โŒ Too Large! โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ”‚
โ”‚                                                           โ”‚
โ”‚  [ TRAFFIC ]    <โ”€โ”€ 100 GB / MONTH โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”‚
โ”‚    โ”œโ”€โ”€ HTML / CSS / JS                              โ”‚     โ”‚
โ”‚    โ”œโ”€โ”€ Images                                       โ”‚     โ”‚
โ”‚    โ””โ”€โ”€ [ VIRAL SURGE ] โ”€โ”€โ”€โ”€โ”€โš ๏ธ Warning Issued โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Canonical URL Authority Flow

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ SEO AUTHORITY REDIRECTION                                 โ”‚
โ”‚                                                           โ”‚
โ”‚  Site A: user.github.io/repo/  (Duplicate)                โ”‚
โ”‚  Site B: www.my-domain.com/    (Authority)                โ”‚
โ”‚                                                           โ”‚
โ”‚  [ SEARCH ENGINE BOT ]                                    โ”‚
โ”‚    โ”‚                                                      โ”‚
โ”‚    โ”œโ”€โ”€ Crawls Site A โ”€โ”€โ”€โ”                                 โ”‚
โ”‚    โ”‚                    โ”‚                                 โ”‚
โ”‚    โ”‚    <link rel="canonical" href="Site B">              โ”‚
โ”‚    โ”‚                    โ”‚                                 โ”‚
โ”‚    โ””โ”€โ”€ Bot gives all SEO "Points" to Site B โ”€โ”€โ”€โ”€โ”€โ”€โ–บ โญ    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Core Web Vitals Optimization

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ RENDERING TIMELINE                                        โ”‚
โ”‚                                                           โ”‚
โ”‚  0ms:   [ Request Sent ]                                  โ”‚
โ”‚  200ms: [ TTFB - GitHub CDN delivers index.html ]        โ”‚
โ”‚  500ms: [ FCP - First meaningful paint ]                  โ”‚
โ”‚  800ms: [ LCP - Hero Image loaded (fetchpriority: high) ] โ”‚
โ”‚  1.2s:  [ TTI - Hydration complete, page interactive ]    โ”‚
โ”‚                                                           โ”‚
โ”‚  Optimization Rule: Inline Critical CSS, Defer Non-Crit JSโ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Summary

ItemValue
Repository Size Limit1 GB
Bandwidth Limit100 GB / Month
Deployment Limit10 builds per hour
Primary SEO Signalrel="canonical"
Indexing Guidesitemap.xml & robots.txt
LCP Target< 2.5 seconds
Cache ControlFixed (10 mins) – Use Hashing
Redirect Strategy301 (via CNAME) / JavaScript

Key takeaways:

  • Quotas are firm but fair. Stay under 1GB for storage and 100GB for bandwidth; offload assets like videos and raw images to external storage to stay compliant.
  • Canonical tags are non-negotiable for SEO. If you use a custom domain, you must use rel="canonical" to prevent search engines from indexing the github.io fallback URL.
  • Sitemaps ensure complete indexing. Use build-time scripts or Jekyll plugins to generate a sitemap.xml so search engines can find every page on your site.
  • Core Web Vitals are the modern speed benchmark. Focus on LCP (hero images) and CLS (layout shifts) by providing explicit dimensions and high priority for critical assets.
  • Cache busting is your only cache control. Since you cannot change GitHub’s server-side cache headers, use content hashing (e.g., style.v2.css) to ensure users receive updates immediately.

Remember: GitHub Pages provides the infrastructure, but you provide the optimization. A fast, SEO-friendly site on GitHub Pages is built by managing your asset sizes, explicitly guiding search crawlers, and ensuring your code follows the “Static-First” performance principles that minimize the browser’s workload.

Was this helpful?


Stop using slow, ad-bloated tool sites! ๐Ÿคฎ

๐Ÿ”Ž Search “KandZ Tools” on Google to use many professional utilities for free.

KandZ.me is the ultimate minimalist hub for:
โœ… Finance (Mortgage, Interest, Inflation)
โœ… Tech (Base64, JSON, Dev Suite, IP)
โœ… Health (BMI, BMR, TDEE)
โœ… Productivity (Timer, Workspace, QR)

โšก๏ธ Fast & Private
๐Ÿ”’ No data leaves your device
๐Ÿ’Ž 100% Free

๐Ÿ”— Use it now: https://tools.kandz.me
๐Ÿ”– Bookmark itโ€”youโ€™ll need it later!