@redpanda-data/docs-extensions-and-macros 3.1.2 → 3.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -8,6 +8,7 @@ module.exports.register = function ({ config }) {
|
|
|
8
8
|
const yaml = require('js-yaml');
|
|
9
9
|
const logger = this.getLogger('global-attributes-extension');
|
|
10
10
|
const chalk = require('chalk')
|
|
11
|
+
const _ = require('lodash');
|
|
11
12
|
|
|
12
13
|
this.on('contentAggregated', ({ siteCatalog, contentAggregate }) => {
|
|
13
14
|
let attributeFile;
|
|
@@ -28,4 +29,17 @@ module.exports.register = function ({ config }) {
|
|
|
28
29
|
logger.error(`Error loading attributes: ${error.message}`);
|
|
29
30
|
}
|
|
30
31
|
})
|
|
32
|
+
.on('contentClassified', async ({ siteCatalog,contentCatalog }) => {
|
|
33
|
+
const components = await contentCatalog.getComponents();
|
|
34
|
+
for (let i = 0; i < components.length; i++) {
|
|
35
|
+
let component = components[i];
|
|
36
|
+
if (component.name !== 'ROOT' && component.name !== 'preview') continue
|
|
37
|
+
|
|
38
|
+
component.versions.forEach(({asciidoc}) => {
|
|
39
|
+
if (siteCatalog.attributeFile) {
|
|
40
|
+
asciidoc.attributes = _.merge({}, siteCatalog.attributeFile, asciidoc.attributes);
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
}
|
|
44
|
+
})
|
|
31
45
|
}
|
|
@@ -28,6 +28,8 @@ function generateIndex (playbook, contentCatalog, { indexLatestOnly = false, exc
|
|
|
28
28
|
|
|
29
29
|
console.log(chalk.cyan('Indexing...'))
|
|
30
30
|
|
|
31
|
+
const unixTimestamp = Math.floor(Date.now() / 1000)
|
|
32
|
+
|
|
31
33
|
// Select indexable pages
|
|
32
34
|
const pages = contentCatalog.getPages((page) => {
|
|
33
35
|
if (!page.out || page.asciidoc?.attributes?.noindex != null) return
|
|
@@ -45,7 +47,6 @@ function generateIndex (playbook, contentCatalog, { indexLatestOnly = false, exc
|
|
|
45
47
|
}
|
|
46
48
|
const urlPath = extractUrlPath(siteUrl)
|
|
47
49
|
|
|
48
|
-
const documents = {}
|
|
49
50
|
var algoliaCount = 0
|
|
50
51
|
|
|
51
52
|
for (var i = 0; i < pages.length; i++) {
|
|
@@ -181,13 +182,13 @@ function generateIndex (playbook, contentCatalog, { indexLatestOnly = false, exc
|
|
|
181
182
|
title: documentTitle,
|
|
182
183
|
product: component.title,
|
|
183
184
|
version: version,
|
|
184
|
-
//image: image? image: '',
|
|
185
185
|
text: text,
|
|
186
186
|
breadcrumbs: breadcrumbs,
|
|
187
187
|
intro: intro,
|
|
188
188
|
objectID: urlPath + page.pub.url,
|
|
189
189
|
titles: titles,
|
|
190
190
|
keywords: keywords,
|
|
191
|
+
unixTimestamp: unixTimestamp,
|
|
191
192
|
type: 'Doc',
|
|
192
193
|
_tags: [tag, 'docs']
|
|
193
194
|
}
|
|
@@ -114,7 +114,7 @@ function register({
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
for (const [objectID, obj] of existingObjectsMap) {
|
|
117
|
-
if (obj.type === 'Doc' && !obj._tags.includes('apis')) {
|
|
117
|
+
if (obj.type === 'Doc' && !obj._tags.includes('apis') || !obj.type) {
|
|
118
118
|
objectsToDelete.push(objectID)
|
|
119
119
|
}
|
|
120
120
|
}
|
|
@@ -7,7 +7,6 @@ antora:
|
|
|
7
7
|
const GetLatestRedpandaVersion = require('./getLatestRedpandaVersion');
|
|
8
8
|
const GetLatestConsoleVersion = require('./getLatestConsoleVersion');
|
|
9
9
|
const chalk = require('chalk')
|
|
10
|
-
const _ = require('lodash');
|
|
11
10
|
|
|
12
11
|
|
|
13
12
|
module.exports.register = function ({ config }) {
|
|
@@ -32,9 +31,6 @@ module.exports.register = function ({ config }) {
|
|
|
32
31
|
if (component.name !== 'ROOT' && component.name !== 'preview') continue
|
|
33
32
|
|
|
34
33
|
component.versions.forEach(({name, version, asciidoc}) => {
|
|
35
|
-
if (siteCatalog.attributeFile) {
|
|
36
|
-
asciidoc.attributes = _.merge(asciidoc.attributes, siteCatalog.attributeFile);
|
|
37
|
-
}
|
|
38
34
|
if (LatestConsoleVersion) {
|
|
39
35
|
asciidoc.attributes['latest-console-version'] = `${LatestConsoleVersion}`;
|
|
40
36
|
console.log(`${chalk.green('Set Redpanda Console version to')} ${chalk.bold(LatestConsoleVersion)} in ${name} ${version}`);
|