77function renderGame ( data ) {
88 // Title
99 document . title = ( data . name || "Game" ) + " – GameDB" ;
10- document . getElementById ( "game-name" ) . textContent = data . name || "Unknown Game" ;
1110
12- // Banner/Artworks (beautiful-jekyll-next style)
11+ // Set game name in both the page header and the content section
12+ const gameName = data . name || "Unknown Game" ;
13+ document . getElementById ( "game-name" ) . textContent = gameName ;
14+
15+ // Also set in page header if it exists
16+ const pageHeaderH1 = document . querySelector ( "header.header-section .page-heading h1" ) ;
17+ if ( pageHeaderH1 ) {
18+ pageHeaderH1 . textContent = gameName ;
19+ }
20+
21+ // Banner/Artworks (inject into existing page header)
1322 if ( data . artworks && data . artworks . length > 0 ) {
14- const bigImgsEl = document . getElementById ( "game-big-imgs" ) ;
15- const bannerHeader = document . getElementById ( "game-banner-header" ) ;
16-
17- // Set data attributes for each artwork
18- bigImgsEl . setAttribute ( "data-num-img" , data . artworks . length ) ;
19- data . artworks . forEach ( ( artwork , index ) => {
20- const imgNum = index + 1 ;
21- bigImgsEl . setAttribute ( `data-img-src-${ imgNum } ` , igdbImageUrl ( artwork . url , "t_screenshot_huge" ) ) ;
22- } ) ;
23+ const bigImgsEl = document . getElementById ( "header-big-imgs" ) ;
24+ const pageHeader = document . querySelector ( "header.header-section .intro-header" ) ;
25+
26+ if ( pageHeader ) {
27+ // Set data attributes for each artwork
28+ bigImgsEl . setAttribute ( "data-num-img" , data . artworks . length ) ;
29+ data . artworks . forEach ( ( artwork , index ) => {
30+ const imgNum = index + 1 ;
31+ bigImgsEl . setAttribute ( `data-img-src-${ imgNum } ` , igdbImageUrl ( artwork . url , "t_screenshot_huge" ) ) ;
32+ } ) ;
33+
34+ // Add big-img class and img-desc span to existing header
35+ pageHeader . classList . add ( "big-img" ) ;
2336
24- // Show the banner
25- bannerHeader . classList . remove ( "d-none" ) ;
37+ // Add img-desc span if it doesn't exist
38+ if ( ! pageHeader . querySelector ( ".img-desc" ) ) {
39+ const imgDesc = document . createElement ( "span" ) ;
40+ imgDesc . className = "img-desc" ;
41+ pageHeader . appendChild ( imgDesc ) ;
42+ }
2643
27- // Initialize the image display (mimics beautifuljekyll.js behavior)
28- initGameBanner ( ) ;
44+ // Initialize the image display
45+ initGameBanner ( ) ;
46+ }
2947 }
3048
3149 // Cover
@@ -364,11 +382,15 @@ function getRegionFlag(regionName) {
364382 * Initialize game banner with cycling images (mimics beautiful-jekyll-next behavior)
365383 */
366384function initGameBanner ( ) {
367- const bigImgsEl = document . getElementById ( "game -big-imgs" ) ;
385+ const bigImgsEl = document . getElementById ( "header -big-imgs" ) ;
368386 const numImgs = parseInt ( bigImgsEl . getAttribute ( "data-num-img" ) ) ;
369387
370388 if ( ! numImgs || numImgs === 0 ) return ;
371389
390+ // Target the existing page header
391+ const introHeader = document . querySelector ( "header.header-section .intro-header.big-img" ) ;
392+ if ( ! introHeader ) return ;
393+
372394 // Set initial image
373395 const getImgInfo = function ( imgNum ) {
374396 const src = bigImgsEl . getAttribute ( `data-img-src-${ imgNum } ` ) ;
@@ -377,15 +399,16 @@ function initGameBanner() {
377399 } ;
378400
379401 const setImg = function ( src , desc ) {
380- const bannerHeader = document . getElementById ( "game-banner-header" ) ;
381- bannerHeader . style . backgroundImage = `url(${ src } )` ;
382-
383- const imgDesc = bannerHeader . querySelector ( ".img-desc" ) ;
384- if ( desc && desc !== "null" ) {
385- imgDesc . textContent = desc ;
386- imgDesc . style . display = "block" ;
387- } else {
388- imgDesc . style . display = "none" ;
402+ introHeader . style . backgroundImage = `url(${ src } )` ;
403+
404+ const imgDesc = introHeader . querySelector ( ".img-desc" ) ;
405+ if ( imgDesc ) {
406+ if ( desc && desc !== "null" ) {
407+ imgDesc . textContent = desc ;
408+ imgDesc . style . display = "block" ;
409+ } else {
410+ imgDesc . style . display = "none" ;
411+ }
389412 }
390413 } ;
391414
@@ -411,7 +434,7 @@ function initGameBanner() {
411434 const img = document . createElement ( "div" ) ;
412435 img . className = "big-img-transition" ;
413436 img . style . backgroundImage = `url(${ src } )` ;
414- document . getElementById ( "game-banner-header" ) . prepend ( img ) ;
437+ introHeader . prepend ( img ) ;
415438
416439 setTimeout ( function ( ) {
417440 img . style . opacity = "1" ;
0 commit comments