File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ export default defineConfig({
37
37
integrations : [
38
38
starlight ( {
39
39
customCss : [ "./src/styles/custom.css" ] ,
40
+ routeMiddleware : [ "./src/plugins/search-topic-middleware.ts" ] ,
40
41
plugins : [
41
42
starlightLlmsTxt ( ) ,
42
43
starlightHeadingBadges ( ) ,
Original file line number Diff line number Diff line change
1
+ import { defineRouteMiddleware } from "@astrojs/starlight/route-data" ;
2
+
3
+ const topics = [
4
+ { key : "/bff/" , value : "Backend For Frontend Security Library" } ,
5
+ { key : "/accesstokenmanagement/" , value : "Access Token Management" } ,
6
+ { key : "/general/" , value : "General" } ,
7
+ { key : "/identitymodel/" , value : "Identity Model" } ,
8
+ {
9
+ key : "/identitymodel-oidcclient/" ,
10
+ value : "Identity Model - OpenID Connect Client" ,
11
+ } ,
12
+ { key : "/identityserver/" , value : "IdentityServer" } ,
13
+ ] ;
14
+
15
+ export const onRequest = defineRouteMiddleware ( ( context ) => {
16
+ const { starlightRoute } = context . locals ;
17
+ const path = starlightRoute . entry . filePath ;
18
+
19
+ const topic = topics . find ( ( t ) => path . includes ( t . key ) ) ?. value ?? "Unknown" ;
20
+
21
+ starlightRoute . head . push ( {
22
+ tag : "meta" ,
23
+ attrs : { "data-pagefind-meta" : `Topic: ${ topic } ` } ,
24
+ } ) ;
25
+ } ) ;
You can’t perform that action at this time.
0 commit comments