Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: nuxt-modules/robots
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v5.2.6
Choose a base ref
...
head repository: nuxt-modules/robots
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v5.2.7
Choose a head ref
  • 6 commits
  • 9 files changed
  • 1 contributor

Commits on Mar 13, 2025

  1. chore: compatibility date

    harlan-zw committed Mar 13, 2025

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    susnux Ferdinand Thiessen
    Copy the full SHA
    db29ab0 View commit details
  2. chore: compatibility date

    harlan-zw committed Mar 13, 2025
    Copy the full SHA
    3c333c1 View commit details
  3. fix(devtools): always add hint in development

    harlan-zw committed Mar 13, 2025
    Copy the full SHA
    032e1f9 View commit details
  4. chore: bump deps

    harlan-zw committed Mar 13, 2025
    Copy the full SHA
    c1751f7 View commit details
  5. doc: i18n starter

    harlan-zw committed Mar 13, 2025
    Copy the full SHA
    a7cbb5c View commit details
  6. chore: release v5.2.7

    harlan-zw committed Mar 13, 2025
    Copy the full SHA
    bae0547 View commit details
6 changes: 6 additions & 0 deletions client/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -3,18 +3,24 @@ import { resolve } from 'pathe'

export default defineNuxtConfig({
ssr: false,

modules: [
DevtoolsUIKit,
],

devtools: {
enabled: false,
},

nitro: {
output: {
publicDir: resolve(__dirname, '../dist/client'),
},
},

app: {
baseURL: '/__nuxt-robots',
},

compatibilityDate: '2025-03-13',
})
2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@
"@nuxt/kit": "^3.16.0",
"floating-vue": "5.2.2",
"nuxt": "latest",
"shiki": "^3.1.0",
"shiki": "^3.2.1",
"vue": "3.5.13",
"vue-router": "latest"
}
1 change: 1 addition & 0 deletions docs/content/1.getting-started/3.troubleshooting.md
Original file line number Diff line number Diff line change
@@ -26,3 +26,4 @@ When submitting an issue, it's important to provide as much information as possi
The easiest way to do this is to create a minimal reproduction using the Stackblitz playgrounds:

- [Basic](https://stackblitz.com/edit/nuxt-starter-zycxux?file=public%2F_robots.txt)
- [I18n](https://stackblitz.com/edit/nuxt-starter-pnej8lvb?file=public%2F_robots.txt)
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "@nuxtjs/robots",
"type": "module",
"version": "5.2.6",
"packageManager": "pnpm@10.6.1",
"version": "5.2.7",
"packageManager": "pnpm@10.6.2",
"description": "Tame the robots crawling and indexing your Nuxt site with ease.",
"author": {
"name": "Harlan Wilton",
@@ -84,7 +84,7 @@
"ufo": "^1.5.4"
},
"devDependencies": {
"@antfu/eslint-config": "^4.7.0",
"@antfu/eslint-config": "^4.10.1",
"@headlessui/vue": "^1.7.23",
"@iconify-json/carbon": "^1.2.8",
"@iconify-json/logos": "^1.2.4",
@@ -94,17 +94,17 @@
"@nuxt/content-v2": "npm:@nuxt/content@2.13.4",
"@nuxt/devtools-ui-kit": "^2.2.1",
"@nuxt/module-builder": "^0.8.4",
"@nuxt/test-utils": "^3.17.1",
"@nuxt/test-utils": "^3.17.2",
"@nuxtjs/color-mode": "^3.5.2",
"@nuxtjs/eslint-config-typescript": "^12.1.0",
"@nuxtjs/i18n": "npm:@nuxtjs/i18n-edge@9.2.1-29013776.4a8d7d5",
"@nuxtjs/i18n": "9.3.1",
"@unocss/nuxt": "^66.0.0",
"@unocss/preset-icons": "^66.0.0",
"@unocss/preset-uno": "^66.0.0",
"@unocss/runtime": "^66.0.0",
"@vueuse/nuxt": "^12.8.2",
"bumpp": "^10.0.3",
"eslint": "^9.21.0",
"@vueuse/nuxt": "^13.0.0",
"bumpp": "^10.1.0",
"eslint": "^9.22.0",
"execa": "^9.5.2",
"firebase-functions": "^6.3.2",
"nuxt": "^3.16.0",
1,807 changes: 1,319 additions & 488 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions src/runtime/app/plugins/robot-meta.server.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useHead } from '#imports'
import { defineNuxtPlugin, useRequestEvent, useRuntimeConfig } from 'nuxt/app'
import { defineNuxtPlugin, useRequestEvent } from 'nuxt/app'

export default defineNuxtPlugin({
setup() {
@@ -8,14 +8,12 @@ export default defineNuxtPlugin({
// set from nitro, not available for internal routes
if (!ctx)
return
const config = useRuntimeConfig()

useHead({
meta: [
{
'name': 'robots',
'content': () => ctx.rule || '',
'data-hint': () => config['nuxt-robots']?.debug && ctx.debug?.source ? `${ctx.debug?.source},${ctx.debug?.line}` : undefined,
'data-hint': () => import.meta.dev && ctx.debug?.source ? `${ctx.debug?.source},${ctx.debug?.line}` : undefined,
},
],
})
3 changes: 3 additions & 0 deletions src/runtime/server/composables/getPathRobotConfig.ts
Original file line number Diff line number Diff line change
@@ -15,6 +15,9 @@ export function getPathRobotConfig(e: H3Event, options?: { userAgent?: string, s
return {
rule: robotsDisabledValue,
indexable: false,
debug: {
source: 'Site Config',
},
}
}
}
4 changes: 2 additions & 2 deletions src/runtime/server/middleware/injectContext.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineEventHandler, setHeader } from 'h3'
import { defineEventHandler, getQuery, setHeader } from 'h3'
import { useRuntimeConfig } from 'nitropack/runtime'
import { getPathRobotConfig } from '../composables/getPathRobotConfig'

@@ -8,7 +8,7 @@ export default defineEventHandler(async (e) => {
const nuxtRobotsConfig = useRuntimeConfig(e)['nuxt-robots']
if (nuxtRobotsConfig) {
const { header } = nuxtRobotsConfig
const robotConfig = getPathRobotConfig(e)
const robotConfig = getPathRobotConfig(e, { skipSiteIndexable: Boolean(getQuery(e)?.mockProductionEnv) })
if (header) {
setHeader(e, 'X-Robots-Tag', robotConfig.rule)
}
10 changes: 7 additions & 3 deletions test/fixtures/i18n/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@ export default defineNuxtConfig({
NuxteRobots,
'@nuxtjs/i18n',
],

site: {
url: 'https://nuxtseo.com',
},
@@ -15,23 +16,26 @@ export default defineNuxtConfig({
ignore: ['/'],
},
},

i18n: {
baseUrl: 'https://nuxtseo.com',
defaultLocale: 'en',
strategy: 'prefix',
locales: [
{
code: 'en',
iso: 'en-US',
language: 'en-US',
},
{
code: 'es',
iso: 'es-ES',
language: 'es-ES',
},
{
code: 'fr',
iso: 'fr-FR',
language: 'fr-FR',
},
],
},

compatibilityDate: '2025-03-13',
})