diff --git a/packages/gitbook/src/components/SitePage/SitePage.tsx b/packages/gitbook/src/components/SitePage/SitePage.tsx index 34abbc72c..e09691beb 100644 --- a/packages/gitbook/src/components/SitePage/SitePage.tsx +++ b/packages/gitbook/src/components/SitePage/SitePage.tsx @@ -317,19 +317,34 @@ async function resolvePageMetaLinks( context: GitBookSiteContext, pageId: string ): Promise { - const pageMetaLinks = await getDataOrNull( - context.changeRequest - ? context.dataFetcher.listChangeRequestPageMetaLinks({ - spaceId: context.space.id, - changeRequestId: context.changeRequest.id, - pageId, - }) - : context.dataFetcher.listSpacePageMetaLinks({ - spaceId: context.space.id, + const pageMetaLinks = await (async () => { + if (context.changeRequest) { + return getDataOrNull( + context.dataFetcher.listChangeRequestPageMetaLinks({ + spaceId: context.space.id, + changeRequestId: context.changeRequest.id, + pageId, + }) + ); + } - pageId, - }) - ); + if (context.revisionId !== context.space.revision) { + return getDataOrNull( + context.dataFetcher.listRevisionPageMetaLinks({ + spaceId: context.space.id, + revisionId: context.revisionId, + pageId, + }) + ); + } + + return getDataOrNull( + context.dataFetcher.listSpacePageMetaLinks({ + spaceId: context.space.id, + pageId, + }) + ); + })(); if (pageMetaLinks) { const canonicalResolution = pageMetaLinks.canonical