File tree Expand file tree Collapse file tree 2 files changed +8
-29
lines changed Expand file tree Collapse file tree 2 files changed +8
-29
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,14 @@ export default defineVersionedConfig(
49
49
50
50
themeConfig : {
51
51
search : {
52
+ options : {
53
+ _render ( src , env , md ) {
54
+ if ( env . frontmatter ?. search === false ) return "" ;
55
+ if ( env . relativePath . startsWith ( "translated/" ) ) return "" ;
56
+ if ( env . relativePath . startsWith ( "versions/" ) ) return "" ;
57
+ return md . render ( src , env ) ;
58
+ } ,
59
+ } ,
52
60
provider : "local" ,
53
61
} ,
54
62
} ,
Original file line number Diff line number Diff line change @@ -138,35 +138,6 @@ import players from "./sidebars/players";
138
138
139
139
console . log ( "Updated internal links." ) ;
140
140
141
- console . log ( "Adding search:false frontmatter to all markdown files..." ) ;
142
-
143
- for ( const file of versionedMarkdownFiles ) {
144
- const data = fs . readFileSync ( file , "utf-8" ) ;
145
- // Check if the file has frontmatter
146
- if ( data . startsWith ( "---" ) ) {
147
- // Find the end of the frontmatter
148
- const endOfFrontmatter = data . indexOf ( "---" , 3 ) ;
149
-
150
- // Extract the frontmatter
151
- let frontmatter = data . slice ( 0 , endOfFrontmatter ) ;
152
-
153
- // Add 'search: false' to the frontmatter
154
- if ( ! frontmatter . includes ( "search:" ) ) {
155
- frontmatter += EOL + "search: false" + EOL ;
156
-
157
- // Replace the old frontmatter with the updated one
158
- const updatedData = frontmatter + data . slice ( endOfFrontmatter ) ;
159
-
160
- // Write the updated data back to the file
161
- fs . writeFile ( file , updatedData , function ( err ) {
162
- if ( err ) {
163
- console . log ( err ) ;
164
- }
165
- } ) ;
166
- }
167
- }
168
- }
169
-
170
141
console . log ( "Adding warning box to index.md..." ) ;
171
142
fs . writeFileSync (
172
143
`./versions/${ oldVersion } /index.md` ,
You can’t perform that action at this time.
0 commit comments