umberto 2.1.0 → 2.1.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "umberto",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "CKSource Documentation builder",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -437,6 +437,7 @@ module.exports = class ApiBuilder {
437
437
  getLinkToSource: githubUrlUtils.getFullGithubLink.bind( this ),
438
438
  docSearchConfig: getDocSearchConfig( this._docSearch, {
439
439
  groups: this._groups,
440
+ slug: this._projectSlug,
440
441
  customRanking: this._projectConfig.docsearch ? this._projectConfig.docsearch.customRanking : []
441
442
  } )
442
443
  };
@@ -10,6 +10,7 @@ const { cloneDeep } = require( 'lodash' );
10
10
 
11
11
  module.exports = ( searchConfig, {
12
12
  groups = [],
13
+ slug = '',
13
14
  customRanking = []
14
15
  } = {} ) => {
15
16
  if ( !searchConfig ) {
@@ -53,7 +54,7 @@ module.exports = ( searchConfig, {
53
54
  ].join( '\n' )
54
55
  };
55
56
 
56
- const transformDataFunctions = getTransformDataFns( groups );
57
+ const transformDataFunctions = getTransformDataFns( groups, slug );
57
58
 
58
59
  if ( transformDataFunctions ) {
59
60
  for ( const tag of Object.keys( transformDataFunctions ) ) {
@@ -86,7 +87,7 @@ module.exports = ( searchConfig, {
86
87
  return docSearchConfig;
87
88
  };
88
89
 
89
- function getTransformDataFns( groups ) {
90
+ function getTransformDataFns( groups, slug ) {
90
91
  if ( !Array.isArray( groups ) || groups.length === 0 ) {
91
92
  return null;
92
93
  }
@@ -114,7 +115,7 @@ function getTransformDataFns( groups ) {
114
115
 
115
116
  `hitsGrouped[ '${ g.slug }' ] = hits`,
116
117
  '.filter( function( h ) {',
117
- `return h.tags.includes( '${ g.slug }' );`,
118
+ `return h.tags.includes( '${ slug }' ) && h.tags.includes( '${ g.slug }' );`,
118
119
  '} )',
119
120
  '.slice( 0, 7 )',
120
121
  '.map( function( item, idx ) {',
@@ -127,7 +128,7 @@ function getTransformDataFns( groups ) {
127
128
  `if ( tag !== '${ g.slug }' ) {`,
128
129
  'hitsGrouped[ tag ] = hits',
129
130
  '.filter( function( h ) {',
130
- 'return h.tags.includes( tag );',
131
+ `return h.tags.includes( '${ slug }' ) && h.tags.includes( tag );`,
131
132
  '} )',
132
133
  '.slice( 0, 10 )',
133
134
  '.map( function( item, idx ) {',
@@ -63,6 +63,7 @@ module.exports = ( ctx, {
63
63
  disableSearch: config.docsearch === false,
64
64
  docSearchConfig: getDocSearchConfig( docSearch, {
65
65
  groups: config.groups,
66
+ slug: config.slug,
66
67
  customRanking: config.docsearch ? config.docsearch.customRanking : []
67
68
  } ),
68
69
  repoUrl: config.repoUrl,
@@ -156,6 +156,7 @@ module.exports = class SdkBuilder {
156
156
  projectSlug,
157
157
  docSearchConfig: getDocSearchConfig( this._docSearch, {
158
158
  groups: this.projectConfig.groups,
159
+ slug: this.projectConfig.slug,
159
160
  customRanking: this.projectConfig.docsearch ? this.projectConfig.docsearch.customRanking : []
160
161
  } )
161
162
  };