You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We now have the ability to define all page metadata for the admin panel
via the Payload Config as a result of #11593. This means we can now set
sensible defaults for additional properties, e.g. `noindex` and
`nofollow` on the `robots` property. Setting this will prevent these
pages from being indexed and appearing in search results.
Note that setting this property prevents _indexing_ these pages, but
does not prevent them from being _crawled_. To prevent crawling as well,
you must add a standalone `robots.txt` file to your root directory.
Copy file name to clipboardExpand all lines: docs/admin/metadata.mdx
+41-3Lines changed: 41 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,7 +53,6 @@ The following options are available for Root Metadata:
53
53
| Key | Type | Description |
54
54
| --- | --- | --- |
55
55
|`defaultOGImageType`|`dynamic` (default), `static`, or `off`| The type of default OG image to use. If set to `dynamic`, Payload will use Next.js image generation to create an image with the title of the page. If set to `static`, Payload will use the `defaultOGImage` URL. If set to `off`, Payload will not generate an OG image. |
56
-
|`icons`|`IconConfig[]`| An array of icon objects. [More details](#icons). |
57
56
|`titleSuffix`|`string`| A suffix to append to the end of the title of every page. Defaults to "- Payload". |
58
57
|`[keyof Metadata]`|`unknown`| Any other properties that Next.js supports within the `generateMetadata` function. [More details](https://nextjs.org/docs/app/api-reference/functions/generate-metadata). |
59
58
@@ -68,7 +67,7 @@ The Icons Config corresponds to the `<link>` tags that are used to specify icons
68
67
69
68
The most common icon type is the favicon, which is displayed in the browser tab. This is specified by the `rel` attribute `icon`. Other common icon types include `apple-touch-icon`, which is used by Apple devices when the Admin Panel is saved to the home screen, and `mask-icon`, which is used by Safari to mask the Admin Panel icon.
70
69
71
-
To customize icons, use the `icons` key within the `admin.meta` object in your Payload Config:
70
+
To customize icons, use the `admin.meta.icons` property in your Payload Config:
72
71
73
72
```ts
74
73
{
@@ -100,7 +99,7 @@ For a full list of all available Icon options, see the [Next.js documentation](h
100
99
101
100
Open Graph metadata is a set of tags that are used to control how URLs are displayed when shared on social media platforms. Open Graph metadata is automatically generated by Payload, but can be customized at the Root level.
102
101
103
-
To customize Open Graph metadata, use the `openGraph` key within the `admin.meta` object in your Payload Config:
102
+
To customize Open Graph metadata, use the `admin.meta.openGraph` property in your Payload Config:
104
103
105
104
```ts
106
105
{
@@ -128,6 +127,45 @@ To customize Open Graph metadata, use the `openGraph` key within the `admin.meta
128
127
129
128
For a full list of all available Open Graph options, see the [Next.js documentation](https://nextjs.org/docs/app/api-reference/functions/generate-metadata#opengraph).
130
129
130
+
### Robots
131
+
132
+
Setting the `robots` property will allow you to control the `robots` meta tag that is rendered within the `<head>` of the Admin Panel. This can be used to control how search engines index pages and displays them in search results.
133
+
134
+
By default, the Admin Panel is set to prevent search engines from indexing pages within the Admin Panel.
135
+
136
+
To customize the Robots Config, use the `admin.meta.robots` property in your Payload Config:
137
+
138
+
```ts
139
+
{
140
+
// ...
141
+
admin: {
142
+
meta: {
143
+
// highlight-start
144
+
robots: 'noindex, nofollow',
145
+
// highlight-end
146
+
},
147
+
},
148
+
}
149
+
```
150
+
151
+
For a full list of all available Robots options, see the [Next.js documentation](https://nextjs.org/docs/app/api-reference/functions/generate-metadata#robots).
152
+
153
+
##### Prevent Crawling
154
+
155
+
While setting meta tags via `admin.meta.robots` can prevent search engines from _indexing_ web pages, it does not prevent them from being _crawled_.
156
+
157
+
To prevent your pages from being crawled altogether, add a `robots.txt` file to your root directory.
158
+
159
+
```txt
160
+
User-agent: *
161
+
Disallow: /admin/
162
+
```
163
+
164
+
<Bannertype="info">
165
+
**Note:**
166
+
If you've customized the path to your Admin Panel via `config.routes`, be sure to update the `Disallow` directive to match your custom path.
167
+
</Banner>
168
+
131
169
## Collection Metadata
132
170
133
171
Collection Metadata is the metadata that is applied to all pages within any given Collection within the Admin Panel. This metadata is used to customize the title and description of all views within any given Collection, unless overridden by the view itself.
0 commit comments