ct-js / ct-js-site

The official site of ct.js
https://ctjs.rocks/
GNU General Public License v3.0
16 stars 13 forks source link

undefined field in madeWithCtjs feed #40

Closed grishy closed 1 month ago

grishy commented 1 year ago

In object Don't Touch It [Free] we don't have a field imageurl.
Source: https://itch.io/games/made-with-ctjs.xml

{
  title: [ "Don't Touch It [Free]" ],
  plainTitle: [ "Don't Touch It" ],
  price: [ '$0.00' ],
  currency: [ 'USD' ],
  link: [ 'https://dino-theepic.itch.io/dont-touch-it' ],
  description: 'This game is simple: Just don't touch anything.\n',
  pubDate: [ 'Thu, 08 Dec 2022 03:38:03 GMT' ],
  createDate: [ 'Thu, 08 Dec 2022 03:38:03 GMT' ],
  updateDate: [ 'Thu, 19 Jan 2023 04:48:37 GMT' ],
  platforms: [ { html: [Array] } ]
}

So, code in madeWithCtjs.pug don't work:

        .inner
            each game, ind in madeWithCtjs.games
                +aCard(game.plainTitle, game.imageurl[0], game.link[0])
                    p=game.description
                if ind % 3 === 2
                    .clear

Result

[17:31:43] Finished 'assets' after 1.1 s
[11ty] Problem writing Eleventy templates:
[11ty] 1. Having trouble rendering pug template ./src/madeWithCtjs.pug (via TemplateContentRenderError)
[11ty] 2. ./src/madeWithCtjs.pug:12
[11ty]     10|         .inner
[11ty]     11|             each game, ind in madeWithCtjs.games
[11ty]   > 12|                 +aCard(game.plainTitle, game.imageurl[0], game.link[0])
[11ty]     13|                     p=game.description
[11ty]     14|                 if ind % 3 === 2
[11ty]     15|                     .clear
[11ty] 
[11ty] Cannot read properties of undefined (reading '0') (via TypeError)
[11ty] Wrote 0 files in 0.77 seconds (v1.0.2)
CosmoMyzrailGorynych commented 1 month ago

Not relevant now