Skip to content

Commit bdff2f3

Browse files
committed
Make landing-page game links relative
Game cards on the landing page were absolute URLs to the apex (https://developertracker.com/<id>/), so a visitor on www.developertracker.com was bounced to the apex on every navigation. Emit relative /<id>/ links instead so the page works identically on www, apex, and pages.dev with no cross-domain hop. Stored game.hostname is now ignored (single-domain).
1 parent c58e8ab commit bdff2f3

2 files changed

Lines changed: 6 additions & 7 deletions

File tree

scripts/build.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -185,14 +185,13 @@ const buildRootPage = function buildRootPage( gamesData ){
185185
}
186186

187187
let name = games[ i ].name;
188-
let url = games[ i ].hostname;
189188
let image = games[ i ].config.boxart;
190189

191-
// Games on the main domain (or with no explicit hostname) link to their
192-
// subfolder. Without this, a missing hostname renders as `https://`.
193-
if ( !url || url === 'developertracker.com' ) {
194-
url = `developertracker.com/${ games[ i ].identifier }/`;
195-
}
190+
// Single-domain: every game lives at /<identifier>/ on whatever host
191+
// serves this page, so the link is relative — a visitor on www stays on
192+
// www instead of being bounced to the apex (or pages.dev). The stored
193+
// game.hostname (now always developertracker.com or empty) is ignored.
194+
const url = `/${ games[ i ].identifier }/`;
196195

197196
renderData.games.push( {
198197
url,

web-assets/games-template.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ <h1>
9393
<div class="games-wrapper js-games-wrapper">
9494
{{#games}}
9595
<div class="game-wrapper">
96-
<a href="https://{{{ url }}}" title="{{ name }} dev tracker">
96+
<a href="{{{ url }}}" title="{{ name }} dev tracker">
9797
<img src="{{{ image }}}">
9898
<h2>{{ name }}</h2>
9999
</a>

0 commit comments

Comments
 (0)