Skip to content

Commit 6f5fbf8

Browse files
author
Luca Forstner
authored
fix(docs): Instruct robots not to index pages that have noindex frontmatter property (#12540)
1 parent 868b983 commit 6f5fbf8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

app/[[...path]]/page.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,8 @@ export async function generateMetadata(props: MetadataProps): Promise<Metadata>
209209
? [{url: `${previewDomain ?? domain}/og.png`, width: 1200, height: 630}]
210210
: [];
211211

212+
let noindex: undefined | boolean = undefined;
213+
212214
const rootNode = await getDocsRootNode();
213215

214216
if (params.path) {
@@ -227,6 +229,8 @@ export async function generateMetadata(props: MetadataProps): Promise<Metadata>
227229
if (pageNode.frontmatter.customCanonicalTag) {
228230
customCanonicalTag = formatCanonicalTag(pageNode.frontmatter.customCanonicalTag);
229231
}
232+
233+
noindex = pageNode.frontmatter.noindex;
230234
}
231235
}
232236

@@ -253,5 +257,6 @@ export async function generateMetadata(props: MetadataProps): Promise<Metadata>
253257
alternates: {
254258
canonical,
255259
},
260+
robots: noindex ? 'noindex' : undefined,
256261
};
257262
}

0 commit comments

Comments
 (0)