feat: defaults to noindex nofollow (#11623)

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.
This commit is contained in:
Jacob Fletcher
2025-03-11 13:29:49 -04:00
committed by GitHub
parent 243cdb1901
commit 5285518562
4 changed files with 53 additions and 4 deletions

View File

@@ -129,7 +129,6 @@ export default buildConfigWithDefaults({
description: 'This is a custom OG description',
title: 'This is a custom OG title',
},
robots: 'nofollow noindex',
titleSuffix: '- Custom Title Suffix',
},
routes: customAdminRoutes,

View File

@@ -158,6 +158,16 @@ describe('General', () => {
})
})
describe('robots', () => {
test('should apply default robots meta tag', async () => {
await page.goto(`${serverURL}/admin`)
await expect(page.locator('meta[name="robots"]')).toHaveAttribute(
'content',
/noindex, nofollow/,
)
})
})
describe('favicons', () => {
test('should render custom favicons', async () => {
await page.goto(postsUrl.admin)