File tree 3 files changed +42
-0
lines changed
3 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -173,6 +173,21 @@ export default defineNuxtModule<ModuleOptions>({
173
173
logger . level = ( config . debug || nuxt . options . debug ) ? 4 : 3
174
174
if ( config . enabled === false ) {
175
175
logger . debug ( 'The module is disabled, skipping setup.' )
176
+ // need to mock the composables to allow module still to work when disabled
177
+ ; [ 'defineRobotMeta' , 'useRobotsRule' ]
178
+ . forEach ( ( name ) => {
179
+ addImports ( { name, from : resolve ( `./runtime/nuxt/composables/mock` ) } )
180
+ } )
181
+ nuxt . options . nitro = nuxt . options . nitro || { }
182
+ nuxt . options . nitro . imports = nuxt . options . nitro . imports || { }
183
+ nuxt . options . nitro . imports . presets = nuxt . options . nitro . imports . presets || [ ]
184
+ nuxt . options . nitro . imports . presets . push ( {
185
+ from : resolve ( './runtime/nitro/composables/mock' ) ,
186
+ imports : [
187
+ 'getPathRobotConfig' ,
188
+ 'getSiteRobotConfig' ,
189
+ ] ,
190
+ } )
176
191
return
177
192
}
178
193
Original file line number Diff line number Diff line change
1
+ import type { H3Event } from 'h3'
2
+
3
+ // eslint-disable-next-line unused-imports/no-unused-vars
4
+ export function getPathRobotConfig ( e : H3Event , options ?: { skipSiteIndexable ?: boolean , path ?: string } ) {
5
+ return {
6
+ indexable : true ,
7
+ rule : '' ,
8
+ }
9
+ }
10
+
11
+ // eslint-disable-next-line unused-imports/no-unused-vars
12
+ export function getSiteRobotConfig ( e : H3Event ) : { indexable : boolean , hints : string [ ] } {
13
+ return {
14
+ indexable : true ,
15
+ hints : [ ] ,
16
+ }
17
+ }
Original file line number Diff line number Diff line change
1
+ import type { MaybeRef } from 'vue'
2
+ import { ref } from '#imports'
3
+
4
+ // eslint-disable-next-line unused-imports/no-unused-vars
5
+ export function defineRobotMeta ( component ?: boolean ) { }
6
+
7
+ // eslint-disable-next-line unused-imports/no-unused-vars
8
+ export function useRobotsRule ( rule ?: MaybeRef < boolean | string > ) {
9
+ return ref ( '' )
10
+ }
You can’t perform that action at this time.
0 commit comments