diff --git a/scripts/games/app.js b/scripts/games/app.js index e19d6fe..975748b 100644 --- a/scripts/games/app.js +++ b/scripts/games/app.js @@ -124,7 +124,16 @@ function processGame(game) { model.testcase_date = recent.date; } - let section_id = `${model.title[0]}`.toLowerCase(); + const toTrim = ["the", "a", "an"]; + + let trimmedTitle = model.title.toLowerCase(); + toTrim.forEach(trim => { + if (trimmedTitle.startsWith(trim)) { + trimmedTitle = trimmedTitle.substr(trim.length + 1); + } + }); + + let section_id = `${trimmedTitle[0]}`; if (!section_id.match(/[a-z]+/)) { section_id = "#"; }