(href)
| 90 | |
| 91 | // Return the product segment from the path |
| 92 | export function getProductStringFromPath(href) { |
| 93 | href = getPathWithoutLanguage(href) |
| 94 | |
| 95 | if (href === '/') return 'homepage' |
| 96 | |
| 97 | const pathParts = href.split('/') |
| 98 | |
| 99 | if (pathParts.includes('early-access')) return 'early-access' |
| 100 | |
| 101 | // For rest pages the currentProduct should be rest |
| 102 | // We use this to show SidebarRest, which is a different sidebar than the rest of the site |
| 103 | if (pathParts[1] === 'rest') return 'rest' |
| 104 | |
| 105 | return productIds.includes(pathParts[2]) ? pathParts[2] : pathParts[1] |
| 106 | } |
| 107 | |
| 108 | export function getCategoryStringFromPath(href) { |
| 109 | href = getPathWithoutLanguage(href) |
no test coverage detected