Getting started category landing page (#17841)
* Start building out landing page in index file * Add articles * Add a couple more popular articles * Tweak intro to cover more audiences * Add TOC back with new organization * Update content/github/getting-started-with-github/index.md * Category as product guides section * Update breadcrumbs.js * Update server.js * Update product-landing.html * Remove TOC listing * Revert removing TOC * Update index.md * Update index.md * Update content/github/getting-started-with-github/index.md * Apply suggestions from code review Co-authored-by: Laura Coursen <lecoursen@github.com> Co-authored-by: Kevin Heis <heiskr@users.noreply.github.com> Co-authored-by: Laura Coursen <lecoursen@github.com>
This commit is contained in:
@@ -90,6 +90,22 @@ function getProductStringFromPath (href) {
|
||||
: pathParts[1]
|
||||
}
|
||||
|
||||
function getCategoryStringFromPath (href) {
|
||||
href = getPathWithoutLanguage(href)
|
||||
|
||||
if (href === '/') return null
|
||||
|
||||
const pathParts = href.split('/')
|
||||
|
||||
if (pathParts.includes('early-access')) return null
|
||||
|
||||
const productIndex = allProducts[pathParts[2]]
|
||||
? 2
|
||||
: 1
|
||||
|
||||
return pathParts[productIndex + 1]
|
||||
}
|
||||
|
||||
// Return the corresponding object for the product segment in a path
|
||||
function getProductObjectFromPath (href) {
|
||||
const productFromPath = getProductStringFromPath(href)
|
||||
@@ -104,5 +120,6 @@ module.exports = {
|
||||
getVersionStringFromPath,
|
||||
getVersionObjectFromPath,
|
||||
getProductStringFromPath,
|
||||
getCategoryStringFromPath,
|
||||
getProductObjectFromPath
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user