Skip to content

Commit 55dedba

Browse files
committed
hide sources that shouldn't be display
1 parent 56eee7b commit 55dedba

File tree

1 file changed

+14
-21
lines changed

1 file changed

+14
-21
lines changed

scripts/papi.js

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,3 @@
1-
// To Do:
2-
// [x] add sources
3-
// [x] support categorization
4-
// [x] support creating new files
5-
// [x] support reading if article is hidden or not
6-
// [x] figure out connection modes for destinations
7-
// [x] retain existing slugify function, to account for custom slug rewrites
8-
// [x] Add dossier content
9-
// [x] make quick info work
10-
// [x] why aren't hidden articles hiding?
11-
// [x] fix slugify overrides?
12-
// [x] fix settings sections
13-
14-
// Notes
15-
// PAPI sources do not include type or categories
16-
17-
181
const axios = require('axios');
192
const path = require('path');
203
const fs = require('fs');
@@ -273,32 +256,42 @@ const updateSources = async () => {
273256
'website'
274257
]
275258

259+
const hiddenSources = [
260+
'amp',
261+
'factual-engine'
262+
]
263+
276264
sources.forEach(source => {
277265
let slug = slugify(source.name)
278266
let settings = source.options
267+
let hidden = false
279268
let mainCategory = source.categories[0] ? source.categories[0].toLowerCase() : ''
280269

270+
// determine the doc url based on the source's main category
281271
if (libraryCategories.includes(mainCategory)) {
282272
url = `connections/sources/catalog/libraries/${mainCategory}/${slug}`
283273
} else {
284274
url = `connections/sources/catalog/cloud-apps/${slug}`
285275
}
286276

277+
// sort the sources alphabetically
287278
settings.sort((a, b) => {
288279
if(a.name < b.name) { return -1; }
289280
if(a.name > b.name) { return 1; }
290281
return 0;
291282
})
292283

293-
// console.log(slug, mainCategory)
284+
// check if the source should be hidden
285+
if (hiddenSources.includes(slug)) {
286+
hidden = true
287+
}
294288

295-
296-
297-
289+
// create the catalog metadata
298290
let updatedSource = {
299291
display_name: source.name,
300292
slug,
301293
url,
294+
hidden,
302295
description: source.description,
303296
logo: {
304297
url: source.logos.default

0 commit comments

Comments
 (0)