11'use strict'
22
33// tag::add-category-pages[]
4- function addKnowledgeBaseCategoryPages ( pages , contentCatalog ) {
4+ function addKnowledgeBaseCategoryPages ( pages , contentCatalog , asciidocConfig ) {
55 const pagesPerCategory = pages
66 . filter ( ( page ) => {
77 return page . src . component === 'kb' &&
@@ -23,22 +23,23 @@ function addKnowledgeBaseCategoryPages (pages, contentCatalog) {
2323 return acc
2424 } , { } )
2525 for ( const [ category , associatedPages ] of Object . entries ( pagesPerCategory ) ) {
26- pages . push ( contentCatalog . addFile ( createKnowledgeBaseCategoryPage ( category , associatedPages ) ) )
26+ pages . push ( contentCatalog . addFile ( createKnowledgeBaseCategoryPage ( category , associatedPages , asciidocConfig ) ) )
2727 }
2828}
2929// end::add-category-pages[]
3030
31- function createKnowledgeBaseCategoryPage ( category , pages ) {
31+ function createKnowledgeBaseCategoryPage ( category , pages , asciidocConfig ) {
32+ const asciidocAttributes = {
33+ ...asciidocConfig . attributes ,
34+ 'page-layout' : 'kb-category' ,
35+ 'page-category' : category ,
36+ 'page-category-pages' : pages ,
37+ 'page-breadcrumb' : category
38+ }
3239 return {
3340 title : `Category ${ category } ` ,
3441 asciidoc : {
35- attributes : {
36- 'page-layout' : 'kb-category' ,
37- 'page-category' : category ,
38- 'page-category-pages' : pages ,
39- 'page-theme' : 'kb' ,
40- 'page-breadcrumb' : category
41- }
42+ attributes : asciidocAttributes
4243 } ,
4344 src : {
4445 component : 'kb' ,
@@ -53,7 +54,7 @@ function createKnowledgeBaseCategoryPage (category, pages) {
5354}
5455
5556// tag::generate-tag-pages[]
56- function addKnowledgeBaseTagPages ( pages , contentCatalog ) {
57+ function addKnowledgeBaseTagPages ( pages , contentCatalog , asciidocConfig ) {
5758 const pagesPerTag = pages
5859 . filter ( ( page ) => {
5960 return page . src . component === 'kb' &&
@@ -77,22 +78,24 @@ function addKnowledgeBaseTagPages (pages, contentCatalog) {
7778 return acc
7879 } , { } )
7980 for ( const [ tag , associatedPages ] of Object . entries ( pagesPerTag ) ) {
80- pages . push ( contentCatalog . addFile ( createKnowledgeBaseTagPage ( tag , associatedPages ) ) )
81+ pages . push ( contentCatalog . addFile ( createKnowledgeBaseTagPage ( tag , associatedPages , asciidocConfig ) ) )
8182 }
8283}
8384// end::generate-tag-pages[]
8485
85- function createKnowledgeBaseTagPage ( tag , pages ) {
86+ function createKnowledgeBaseTagPage ( tag , pages , asciidocConfig ) {
87+ console . log ( { asciidocConfig} )
88+ const asciidocAttributes = {
89+ ...asciidocConfig . attributes ,
90+ 'page-layout' : 'kb-tag' ,
91+ 'page-tag' : tag ,
92+ 'page-tag-pages' : pages ,
93+ 'page-breadcrumb' : tag ,
94+ }
8695 return {
8796 title : `Tag ${ tag } ` ,
8897 asciidoc : {
89- attributes : {
90- 'page-layout' : 'kb-tag' ,
91- 'page-tag' : tag ,
92- 'page-tag-pages' : pages ,
93- 'page-theme' : 'kb' ,
94- 'page-breadcrumb' : tag
95- }
98+ attributes : asciidocAttributes
9699 } ,
97100 src : {
98101 component : 'kb' ,
0 commit comments