From 369f281fb77a732bda98c5528dbaf72aec2c874a Mon Sep 17 00:00:00 2001 From: Harlan Wilton Date: Sat, 17 Dec 2022 16:49:09 +1100 Subject: [PATCH] fix(robots): fix host --- server/routes/robots.txt.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/routes/robots.txt.ts b/server/routes/robots.txt.ts index 26d33aca..60f3eb40 100644 --- a/server/routes/robots.txt.ts +++ b/server/routes/robots.txt.ts @@ -1,8 +1,9 @@ import config from 'nuxt-seo-kit/config' import { defineEventHandler, setHeader } from 'h3' +import { withBase } from 'ufo' export default defineEventHandler(async (event) => { setHeader(event, 'Content-Type', 'text/plain') const debug = process.dev ? (`# Dev Mode: Generated by nuxt-seo-kit for ${config.hostname}. Indexing is ${config.indexable ? 'allowed' : 'disallowed'}\n`) : '' - return `${debug}User-agent: *\nDisallow: ${config.indexable ? `\nSitemap: ${config.hostname}/sitemap.xml` : '/'}` + return `${debug}User-agent: *\nDisallow: ${config.indexable ? `\n\nSitemap: ${withBase('sitemap.xml', config.hostname)}` : '/'}` })