Skip to content

Commit

Permalink
fix!: migrate to @nuxtjs/robots
Browse files Browse the repository at this point in the history
  • Loading branch information
harlan-zw committed Jul 15, 2024
1 parent f2a7e61 commit 991bfda
Show file tree
Hide file tree
Showing 12 changed files with 435 additions and 382 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ With powerful APIs built for fully dynamic sites and zero-config defaults for st
## Modules

- 📖 [@nuxtjs/sitemap](https://github.com/nuxt-modules/sitemap) - Sitemap.xml Support
- 🤖 [nuxt-simple-robots](https://github.com/harlan-zw/nuxt-simple-robots) - Manage site crawling
- 🤖 [@nuxtjs/robots](https://github.com/nuxt-modules/robots) - Manage site crawling
- 🔎 [nuxt-schema-org](https://github.com/harlan-zw/nuxt-schema-org) - Generate Schema.org JSON-LD for SEO
-[nuxt-seo-experiments](https://github.com/harlan-zw/nuxt-seo-experiments) - Experimental SEO meta features
- 🖼️ [nuxt-og-image](https://github.com/nuxt-modules/og-image) - Generate dynamic social share images
Expand Down
2 changes: 1 addition & 1 deletion docs/content/0.nuxt-seo/2.guides/0.using-the-modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Since Nuxt SEO installs and enables modules for you, you may run into a situatio
The modules have these config keys:
- `nuxt-og-image` - `ogImage`
- `@nuxtjs/sitemap` - `sitemap`
- `nuxt-simple-robots` - `robots`
- `@nuxtjs/robots` - `robots`
- `nuxt-seo-experiments` - `seoExperiments`
- `nuxt-schema-org` - `schemaOrg`
- `nuxt-link-checker` - `linkChecker`
Expand Down
6 changes: 3 additions & 3 deletions docs/content/1.robots/1.getting-started/0.features.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
title: 'Nuxt Simple Robots Features'
description: 'Get started with nuxt-simple-robots by installing the dependency to your project.'
title: 'Nuxt Robots Features'
description: 'Nuxt Robots manages the robots crawling your site with minimal config and best practice defaults.'
navigation:
title: 'Features'
---

Nuxt Simple Robots manages the robots crawling your site with minimal config and best practice defaults.
Nuxt Robots manages the robots crawling your site with minimal config and best practice defaults.

## 🤖 Robots.txt Config

Expand Down
8 changes: 4 additions & 4 deletions docs/content/1.robots/1.getting-started/0.installation.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: 'Install Nuxt Simple Robots'
description: 'Get started with nuxt-simple-robots by installing the dependency to your project.'
title: 'Install Nuxt Robots'
description: 'Get started with Nuxt Robots by installing the dependency to your project.'
navigation:
title: 'Installation'
---
Expand All @@ -9,10 +9,10 @@ Using [Nuxt SEO](/nuxt-seo/getting-started/installation)? This module is already

## Setup

1. Install `nuxt-simple-robots` dependency to your project:
1. Install `nuxt-robots` dependency to your project:

```bash
npx nuxi@latest module add simple-robots
npx nuxi@latest module add robots
```

## Staging / Testing Environments
Expand Down
8 changes: 4 additions & 4 deletions docs/content/1.robots/3.api/1.config.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Nuxt Config
description: Learn how to configure nuxt-simple-robots using nuxt.config.
description: Learn how to configure Nuxt Robots using nuxt.config.
---

## `enabled`
Expand Down Expand Up @@ -120,7 +120,7 @@ When set to `false`, no merging will occur.

Blocks some non-SEO bots from crawling your site. This is not a replacement for a full-blown bot management solution, but it can help to reduce the load on your server.

See [const.ts](https://github.com/harlan-zw/nuxt-simple-robots/blob/main/src/const.ts#L6) for the list of bots that are blocked.
See [const.ts](https://github.com/nuxt-modules/robots/blob/main/src/const.ts#L6) for the list of bots that are blocked.

```ts
export default defineNuxtConfig({
Expand All @@ -147,9 +147,9 @@ Enables debug logs and a debug endpoint.
Control the module credit comment in the generated robots.txt file.

```txt
# START nuxt-simple-robots (indexable) <- credits
# START nuxt-robots (indexable) <- credits
...
# END nuxt-simple-robots <- credits
# END nuxt-robots <- credits
```

```ts
Expand Down
6 changes: 3 additions & 3 deletions docs/content/1.robots/4.releases/0.v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default defineNuxtConfig({

Blocks some non-SEO bots from crawling your site. This is not a replacement for a full-blown bot management solution, but it can help to reduce the load on your server.

See [const.ts](https://github.com/harlan-zw/nuxt-simple-robots/blob/main/src/const.ts#L6) for the list of bots that are blocked.
See [const.ts](https://github.com/nuxt-modules/robots/blob/main/src/const.ts#L6) for the list of bots that are blocked.

```ts
export default defineNuxtConfig({
Expand All @@ -79,9 +79,9 @@ This has been changed to include all `disallow` paths for the `*` user-agent by
Control the module credit comment in the generated robots.txt file.

```txt
# START nuxt-simple-robots (indexable) <- credits
# START nuxt-robots (indexable) <- credits
...
# END nuxt-simple-robots <- credits
# END nuxt-robots <- credits
```

```ts
Expand Down
28 changes: 26 additions & 2 deletions docs/content/1.robots/4.releases/1.v4.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,32 @@ title: v4.0.0
description: Release notes for Nuxt Simple Robots v4.0.0.
---

## Nuxt Simple Robots is now Nuxt Robots

In a [discussion](https://github.com/nuxt-modules/robots/issues/116) with the team and the community, we have decided to migrate `nuxt-simple-robots` into the `@nuxtjs/robots` module.

This will allow me to better maintain the module and provide a more consistent experience across the Nuxt ecosystem.

To upgrade simply replace the dependency in `package.json` and update your nuxt.config. Other changes are below.

```diff
- 'nuxt-simple-robots'
+ '@nuxtjs/robots'
```

## :icon{name="i-noto-rocket"} Features

### useRobotsRule()

A new Nuxt composable [useRobotsRule()](/robots/api/use-robots-rule) has been introduced to allow you to access and modify the current robots rule for the current route.

```ts
import { useRobotsRule } from '#imports'

const rule = useRobotsRule()
// Ref<'noindex, nofollow'>
```

### Robots.txt validation :icon{name="i-noto-check-mark-button"}

When loading in a `robots.txt` file, the module will now validate the file to ensure each of the `disallow` and `allow` paths are valid.
Expand Down Expand Up @@ -83,10 +107,10 @@ In this version the new hook Nitro hook as introduced `robots:config`. This hook
will let you override the robots.txt data as a JavaScript object, instead of a string.

Like-wise you can now re-use any of the internal functions to parse, validate and generate
robots.txt data using the `nuxt-simple-robots/util` export.
robots.txt data using the `@nuxtjs/robots/util` export.

```ts
import { parseRobotsTxt } from 'nuxt-simple-robots/util'
import { parseRobotsTxt } from '@nuxtjs/robots/util'

export default defineNitroPlugin((nitroApp) => {
nitroApp.hooks.hook('robots:config', async (ctx) => {
Expand Down
2 changes: 1 addition & 1 deletion docs/content/2.sitemap/1.integrations/2.robots.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Nuxt Simple Robots
description: How to use the Nuxt Simple Robots module with Nuxt Content.
---

The [nuxt-simple-robots](https://github.com/harlan-zw/nuxt-simple-robots) module is useful for creating a dynamic runtime robots.txt file.
The [@nuxtjs/robots](https://github.com/nuxt-modules/robots) module is useful for creating a dynamic runtime robots.txt file.

## Setup

Expand Down
8 changes: 4 additions & 4 deletions docs/utils/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ export const SiteConfigModule: NuxtSeoModule = {
} as const

export const RobotsModule = {
id: 'simple-robots',
id: 'robots',
slug: 'robots',
label: 'Robots',
fullLabel: 'Nuxt Simple Robots',
fullLabel: 'Nuxt Robots',
icon: 'i-carbon-bot',
description: 'Tame the robots crawling and indexing your site with ease.',
tag: {
Expand All @@ -71,9 +71,9 @@ export const RobotsModule = {
date: new Date('2023-12-14'),
},
to: '/robots/getting-started/installation',
repo: 'harlan-zw/nuxt-simple-robots',
repo: 'nuxt-modules/robots',
routeRules: {
site: { name: 'Nuxt Simple Robots', description: 'Tame the robots crawling and indexing your site with ease.' },
site: { name: 'Nuxt Robots', description: 'Tame the robots crawling and indexing your site with ease.' },
ogImage: { icon: 'i-carbon-bot' },
},
} as const
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@
},
"dependencies": {
"@nuxt/kit": "^3.12.3",
"@nuxtjs/sitemap": "^5.3.2",
"@nuxtjs/robots": "^4.0.0-rc.22",
"@nuxtjs/sitemap": "^5.3.4",
"defu": "^6.1.4",
"nuxt-link-checker": "^3.0.0-rc.12",
"nuxt-og-image": "^3.0.0-rc.61",
"nuxt-schema-org": "^3.3.8",
"nuxt-seo-experiments": "^4.0.0-rc.13",
"nuxt-simple-robots": "^4.0.0-rc.20",
"nuxt-site-config": "^2.2.14",
"nuxt-site-config-kit": "^2.2.14",
"pkg-types": "^1.1.3",
Expand All @@ -68,7 +68,7 @@
"nitropack": "^2.9.7",
"nuxt": "^3.12.3",
"typescript": "5.4.5",
"vitest": "^2.0.2"
"vitest": "^2.0.3"
},
"resolutions": {
"shiki": "1.10.1"
Expand Down
Loading

0 comments on commit 991bfda

Please sign in to comment.