|
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 |
| - |
18 | 1 | const axios = require('axios');
|
19 | 2 | const path = require('path');
|
20 | 3 | const fs = require('fs');
|
@@ -273,32 +256,42 @@ const updateSources = async () => {
|
273 | 256 | 'website'
|
274 | 257 | ]
|
275 | 258 |
|
| 259 | + const hiddenSources = [ |
| 260 | + 'amp', |
| 261 | + 'factual-engine' |
| 262 | + ] |
| 263 | + |
276 | 264 | sources.forEach(source => {
|
277 | 265 | let slug = slugify(source.name)
|
278 | 266 | let settings = source.options
|
| 267 | + let hidden = false |
279 | 268 | let mainCategory = source.categories[0] ? source.categories[0].toLowerCase() : ''
|
280 | 269 |
|
| 270 | + // determine the doc url based on the source's main category |
281 | 271 | if (libraryCategories.includes(mainCategory)) {
|
282 | 272 | url = `connections/sources/catalog/libraries/${mainCategory}/${slug}`
|
283 | 273 | } else {
|
284 | 274 | url = `connections/sources/catalog/cloud-apps/${slug}`
|
285 | 275 | }
|
286 | 276 |
|
| 277 | + // sort the sources alphabetically |
287 | 278 | settings.sort((a, b) => {
|
288 | 279 | if(a.name < b.name) { return -1; }
|
289 | 280 | if(a.name > b.name) { return 1; }
|
290 | 281 | return 0;
|
291 | 282 | })
|
292 | 283 |
|
293 |
| - // console.log(slug, mainCategory) |
| 284 | + // check if the source should be hidden |
| 285 | + if (hiddenSources.includes(slug)) { |
| 286 | + hidden = true |
| 287 | + } |
294 | 288 |
|
295 |
| - |
296 |
| - |
297 |
| - |
| 289 | + // create the catalog metadata |
298 | 290 | let updatedSource = {
|
299 | 291 | display_name: source.name,
|
300 | 292 | slug,
|
301 | 293 | url,
|
| 294 | + hidden, |
302 | 295 | description: source.description,
|
303 | 296 | logo: {
|
304 | 297 | url: source.logos.default
|
|
0 commit comments