33const cheerio = require ( 'cheerio' )
44
55// tag::add-category-pages[]
6- function addKnowledgeBaseCategoryPages ( pages , contentCatalog ) {
6+ function addKnowledgeBaseCategoryPages ( pages , contentCatalog , asciidocConfig ) {
77 const pagesPerCategory = pages
88 . filter ( ( page ) => {
99 return page . src . component === 'kb' &&
@@ -25,22 +25,23 @@ function addKnowledgeBaseCategoryPages (pages, contentCatalog) {
2525 return acc
2626 } , { } )
2727 for ( const [ category , associatedPages ] of Object . entries ( pagesPerCategory ) ) {
28- pages . push ( contentCatalog . addFile ( createKnowledgeBaseCategoryPage ( category , associatedPages ) ) )
28+ pages . push ( contentCatalog . addFile ( createKnowledgeBaseCategoryPage ( category , associatedPages , asciidocConfig ) ) )
2929 }
3030}
3131// end::add-category-pages[]
3232
33- function createKnowledgeBaseCategoryPage ( category , pages ) {
33+ function createKnowledgeBaseCategoryPage ( category , pages , asciidocConfig ) {
34+ const asciidocAttributes = {
35+ ...asciidocConfig . attributes ,
36+ 'page-layout' : 'kb-category' ,
37+ 'page-category' : category ,
38+ 'page-category-pages' : pages ,
39+ 'page-breadcrumb' : category
40+ }
3441 return {
3542 title : `Category ${ category } ` ,
3643 asciidoc : {
37- attributes : {
38- 'page-layout' : 'kb-category' ,
39- 'page-category' : category ,
40- 'page-category-pages' : pages ,
41- 'page-theme' : 'kb' ,
42- 'page-breadcrumb' : category
43- }
44+ attributes : asciidocAttributes
4445 } ,
4546 src : {
4647 component : 'kb' ,
@@ -55,7 +56,7 @@ function createKnowledgeBaseCategoryPage (category, pages) {
5556}
5657
5758// tag::generate-tag-pages[]
58- function addKnowledgeBaseTagPages ( pages , contentCatalog ) {
59+ function addKnowledgeBaseTagPages ( pages , contentCatalog , asciidocConfig ) {
5960 const pagesPerTag = pages
6061 . filter ( ( page ) => {
6162 return page . src . component === 'kb' &&
@@ -79,22 +80,24 @@ function addKnowledgeBaseTagPages (pages, contentCatalog) {
7980 return acc
8081 } , { } )
8182 for ( const [ tag , associatedPages ] of Object . entries ( pagesPerTag ) ) {
82- pages . push ( contentCatalog . addFile ( createKnowledgeBaseTagPage ( tag , associatedPages ) ) )
83+ pages . push ( contentCatalog . addFile ( createKnowledgeBaseTagPage ( tag , associatedPages , asciidocConfig ) ) )
8384 }
8485}
8586// end::generate-tag-pages[]
8687
87- function createKnowledgeBaseTagPage ( tag , pages ) {
88+ function createKnowledgeBaseTagPage ( tag , pages , asciidocConfig ) {
89+ console . log ( { asciidocConfig} )
90+ const asciidocAttributes = {
91+ ...asciidocConfig . attributes ,
92+ 'page-layout' : 'kb-tag' ,
93+ 'page-tag' : tag ,
94+ 'page-tag-pages' : pages ,
95+ 'page-breadcrumb' : tag ,
96+ }
8897 return {
8998 title : `Tag ${ tag } ` ,
9099 asciidoc : {
91- attributes : {
92- 'page-layout' : 'kb-tag' ,
93- 'page-tag' : tag ,
94- 'page-tag-pages' : pages ,
95- 'page-theme' : 'kb' ,
96- 'page-breadcrumb' : tag
97- }
100+ attributes : asciidocAttributes
98101 } ,
99102 src : {
100103 component : 'kb' ,
0 commit comments