build(aio): compute breadcrums for all API doc types (#24000)

PR Close #24000
This commit is contained in:
Pete Bacon Darwin
2018-05-23 22:20:14 +01:00
committed by Miško Hevery
parent 1e04df9ac7
commit f43cb9398c
2 changed files with 14 additions and 10 deletions

View File

@ -1,16 +1,15 @@
module.exports = function computeApiBreadCrumbs(EXPORT_DOC_TYPES) {
module.exports = function computeApiBreadCrumbs(API_DOC_TYPES_TO_RENDER) {
return {
$runAfter: ['paths-computed'],
$runBefore: ['rendering-docs'],
$process(docs) {
// Compute the breadcrumb for each doc by processing its containers
docs.forEach(doc => {
if (EXPORT_DOC_TYPES.indexOf(doc.docType) !== -1) {
doc.breadCrumbs = [
{ text: 'API', path: '/api' },
{ text: '@angular/' + doc.moduleDoc.id, path: doc.moduleDoc.path },
{ text: doc.name, path: doc.path }
];
if (API_DOC_TYPES_TO_RENDER.indexOf(doc.docType) !== -1) {
doc.breadCrumbs = [];
doc.breadCrumbs.push({ text: 'API', path: '/api' });
if (doc.moduleDoc) doc.breadCrumbs.push({ text: '@angular/' + doc.moduleDoc.id, path: doc.moduleDoc.path });
doc.breadCrumbs.push({ text: doc.name, path: doc.path });
}
});
}