File tree Expand file tree Collapse file tree 8 files changed +12
-6
lines changed Expand file tree Collapse file tree 8 files changed +12
-6
lines changed Load Diff Large diffs are not rendered by default.
Load Diff Large diffs are not rendered by default.
Load Diff Large diffs are not rendered by default.
Load Diff Large diffs are not rendered by default.
Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change @@ -40,3 +40,6 @@ export const getExampleCode = async (exampleId: string): Promise<string> => {
40
40
const assetMigratedCode = code . replaceAll ( / \( [ " ' ] a s s e t s / g, "('/assets" ) ;
41
41
return assetMigratedCode ;
42
42
} ;
43
+
44
+ export const removeNestedReferencePaths = ( route : string ) : string =>
45
+ route . replace ( / c o n s t a n t s \/ | t y p e s \/ / , "" )
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import { JSDOM } from "jsdom";
13
13
import type { JumpToLink , JumpToState } from "../globals/state" ;
14
14
import { categories as referenceCategories } from "../content/reference/config" ;
15
15
import memoize from "lodash/memoize" ;
16
+ import { removeNestedReferencePaths } from "./_utils-node" ;
16
17
17
18
interface EntryWithId {
18
19
id : string ;
@@ -152,7 +153,7 @@ export const getExampleCategory = (slug: string): string =>
152
153
slug . split ( "/" ) [ 1 ] . split ( "_" ) . splice ( 1 ) . join ( " " ) ;
153
154
154
155
export const normalizeReferenceRoute = ( route : string ) : string =>
155
- removeLocaleAndExtension ( route ) . replace ( / c o n s t a n t s \/ | t y p e s \/ / , "" ) ;
156
+ removeNestedReferencePaths ( removeLocaleAndExtension ( route ) ) ;
156
157
157
158
export const removeLocaleAndExtension = ( id : string ) : string =>
158
159
removeContentFileExt ( removeLeadingSlash ( removeLocalePrefix ( id ) ) ) ;
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import keywordExtractor from "keyword-extractor";
10
10
import { contentTypes } from "../../globals/globals" ;
11
11
import { supportedLocales as localesWithSearchSupport } from "../../i18n/const" ;
12
12
import type { LanguageName } from "keyword-extractor/types/lib/keyword_extractor" ;
13
+ import { removeNestedReferencePaths } from "../../pages/_utils-node" ;
13
14
14
15
interface SearchIndex {
15
16
[ title : string ] : {
@@ -236,6 +237,7 @@ export const generateSearchIndex = async (
236
237
description = getKeywordsFromContent ( content , locale ) ;
237
238
break ;
238
239
case "reference" :
240
+ relativeUrl = removeNestedReferencePaths ( relativeUrl ) ;
239
241
title = data . title ;
240
242
// If the class is something like "p5.Vector"
241
243
// we include the class in the title and add an alias for easier searching
You can’t perform that action at this time.
0 commit comments