1
0
mirror of synced 2025-12-23 11:54:18 -05:00
Files
docs/lib/get-document-type.js
2021-03-29 19:38:29 -04:00

18 lines
381 B
JavaScript

module.exports = function getDocumentType (relativePath) {
if (!relativePath.endsWith('index.md')) {
return 'article'
}
// Derive the document type from the path segment length
switch (relativePath.split('/').length) {
case 1:
return 'homepage'
case 2:
return 'product'
case 3:
return 'category'
case 4:
return 'mapTopic'
}
}