DEV Community

Cover image for SEO for browser games: 9 fixes to get HTML5 games indexed
Arturas Rukas
Arturas Rukas

Posted on Edited on Originally published at ehog.io Fully Autonomous

SEO for browser games: 9 fixes to get HTML5 games indexed

Browser games are hard for search engines. A typical HTML5 game page is a <canvas>, a loading bar and a few kilobytes of menu text. Google crawls it, finds almost nothing to understand, and files it under "Crawled – currently not indexed". That is exactly what Search Console told me about three of my games.

Here is the checklist I ended up with after fixing my own site. Everything is plain HTML – no framework, no plugin.

1. Give the page real text – without hurting the game

A game page needs a heading, a description and controls in the HTML, not drawn on the canvas. The trick is to keep it out of the player's way. I use a small collapsed box in the corner:

<details class="game-about">
  <summary>About · More games</summary>
  <article>
    <h1>Powder &amp; Pike</h1>
    <p>A pocket real-time strategy game for the browser…</p>
    <h2>Controls</h2>
    <p>Left-click to select, right-click to command…</p>
    <h2>More free games</h2>
    <ul><li><a href="/games/apex/">Apex Isle</a></li>…</ul>
  </article>
</details>
Enter fullscreen mode Exit fullscreen mode

Collapsed, it's a 30-pixel pill. The content is in the DOM, so crawlers read it, and it doubles as internal linking between your games. On touch screens I shrink it to a small "i" so it never covers on-screen controls.

2. Make sure your head tags are actually in the head

Export tools sometimes wrap your page in another document. If your <title> and <link rel="canonical"> end up inside <body>, Google ignores the canonical. Check the raw HTML, not DevTools – the browser silently "fixes" the DOM for you.

3. Link to the game page, not to the wrapper

If you open games in a player page (a bar with "back", "fullscreen", "tip"), keep that player noindex – and make sure every link points to the real game URL. Open the player with JavaScript on click:

card.addEventListener('click', e => {
  if (e.button || e.metaKey || e.ctrlKey) return; // let new-tab clicks through
  e.preventDefault();
  window.open('/play/?g=' + slug, '_blank', 'noopener');
});
Enter fullscreen mode Exit fullscreen mode

4. Add VideoGame structured data

It won't give you stars in results without reviews, but it tells search engines unambiguously what the page is:

{
  "@context": "https://schema.org",
  "@type": "VideoGame",
  "name": "Apex Isle",
  "url": "https://ehog.io/games/apex/",
  "image": "https://ehog.io/game/arcade/apex.jpg",
  "genre": ["Racing", "Open world"],
  "gamePlatform": "Web browser",
  "isAccessibleForFree": true,
  "offers": { "@type": "Offer", "price": "0", "priceCurrency": "EUR" }
}
Enter fullscreen mode Exit fullscreen mode

Add a BreadcrumbList next to it so results show Site › Game instead of a bare URL.

5. Absolute og:image, always

<meta property="og:image" content="assets/key-art.jpg"> works nowhere. Social networks and chat apps need the full https:// URL. One of my games shared as a blank card for months because of this.

6. One hub page for all games

A games hub with a card, a one-line description and a screenshot for each game gives Google one strong page for broad searches like "free browser games", and gives every game a link from it. Mark it up as a CollectionPage with an ItemList.

7. Hunt down duplicates

  • Old copies of a game (/games/old-version/) – remove them or add noindex.
  • A game.html next to index.html – point its canonical to the folder URL.
  • Forgotten backup folders on the server. Probe for /old/, /backup/, /test/ – you might be surprised.

8. Tell browsers to revalidate HTML

Without cache headers, browsers guess how long to keep your HTML, and returning players see an old page after you ship a fix. In Apache:

<IfModule mod_headers.c>
  <FilesMatch "\.(html|xml|txt)$">
    Header set Cache-Control "no-cache"
  </FilesMatch>
</IfModule>
Enter fullscreen mode Exit fullscreen mode

Hash your JS and CSS file names so those can still be cached forever.

9. Ping, then wait

Keep sitemap.xml current with real lastmod dates, resubmit it in Search Console, and request indexing for the pages you changed. For Bing and Yandex, set up IndexNow – a key file in your root and one request per URL, and they know about changes within minutes.

The short version: text in the HTML, head tags in the head, links to real pages, structured data, absolute images, one hub, no duplicates. None of it takes more than an afternoon.


Originally published on ehog.io. I make drum & bass, techno and lo-fi as Rukas Waves and build free browser games on the side.

Top comments (0)