| 4 | import { allVersionKeys } from '../../lib/all-versions.js' |
| 5 | |
| 6 | const isHomepage = (path) => { |
| 7 | const split = path.split('/') |
| 8 | // E.g. `/foo` but not `foo/bar` or `foo/` |
| 9 | if (split.length === 2 && split[1] && !split[0]) { |
| 10 | return languageKeys.includes(split[1]) |
| 11 | } |
| 12 | // E.g. `/foo/possiblyproductname` but not `foo/possiblyproductname` or |
| 13 | // `/foo/something/` |
| 14 | if (split.length === 3 && !split[0] && split[2]) { |
| 15 | return allVersionKeys.includes(split[2]) |
| 16 | } |
| 17 | return false |
| 18 | } |
| 19 | |
| 20 | export default async function productGroups(req, res, next) { |
| 21 | // It's important to use `req.pathPage` instead of `req.path` because |