We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d97726b commit 1cc6ac4Copy full SHA for 1cc6ac4
src/runtime/nitro/server/middleware.ts
@@ -6,9 +6,12 @@ export default defineEventHandler(async (e) => {
6
if (e.path === '/robots.txt' || e.path.startsWith('/__') || e.path.startsWith('/api') || e.path.startsWith('/_nuxt'))
7
return
8
const robotConfig = getPathRobotConfig(e)
9
- const { header } = useRuntimeConfig(e)['nuxt-robots']
10
- if (header) {
11
- setHeader(e, 'X-Robots-Tag', robotConfig.rule)
+ const nuxtRobotsConfig = useRuntimeConfig(e)['nuxt-robots']
+ if (nuxtRobotsConfig) {
+ const { header } = nuxtRobotsConfig
12
+ if (header) {
13
+ setHeader(e, 'X-Robots-Tag', robotConfig.rule)
14
+ }
15
+ e.context.robots = robotConfig
16
}
- e.context.robots = robotConfig
17
})
0 commit comments