Skip to content

Commit fe172f1

Browse files
committed
Propagate AsciiDoc config
1 parent 2234a2a commit fe172f1

File tree

2 files changed

+25
-22
lines changed

2 files changed

+25
-22
lines changed

lib/generate-site.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ async function generateSite (args, env) {
2222
loadUi(playbook),
2323
])
2424
const pages = convertDocuments(contentCatalog, asciidocConfig)
25-
knowledgeBase.addCategoryPages(pages, contentCatalog)
26-
knowledgeBase.addTagPages(pages, contentCatalog)
25+
knowledgeBase.addCategoryPages(pages, contentCatalog, asciidocConfig)
26+
knowledgeBase.addTagPages(pages, contentCatalog, asciidocConfig)
2727
const navigationCatalog = buildNavigation(contentCatalog, asciidocConfig)
2828
training.attachNavigationSlug(contentCatalog, navigationCatalog)
2929
const composePage = createPageComposer(playbook, contentCatalog, uiCatalog, env)

lib/knowledge-base.js

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
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

Comments
 (0)