tisonkun commented on code in PR #481:
URL: https://github.com/apache/pulsar-site/pull/481#discussion_r1144570593


##########
src/theme/DocPage/index.tsx:
##########
@@ -0,0 +1,74 @@
+import React from 'react';
+import clsx from 'clsx';
+import {HtmlClassNameProvider, PageMetadata, ThemeClassNames,} from 
'@docusaurus/theme-common';
+import {
+  DocsSidebarProvider,
+  DocsVersionProvider,
+  docVersionSearchTag,
+  useDocRouteMetadata,
+} from '@docusaurus/theme-common/internal';
+import DocPageLayout from '@theme/DocPage/Layout';
+import NotFound from '@theme/NotFound';
+import SearchMetadata from '@theme/SearchMetadata';
+import type {Props} from '@theme/DocPage';
+import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
+import useBaseUrl from "@docusaurus/useBaseUrl";
+
+function createCanonicalHref(props: Props): string {
+  const {siteConfig} = useDocusaurusContext();
+  const {versionMetadata, location, match} = props;
+  if (versionMetadata.version === 'current') {
+    // 1. The NEXT version docs should not forward to the latest stable version
+    // 2. Other plugins-doc instance (contribute, release-note, ...) happens 
to keep the link
+    return siteConfig.url + useBaseUrl(location.pathname);
+  }
+  const basename = location.pathname.replace(match.path, '');
+  return siteConfig.url + useBaseUrl(`/docs/${basename}`);
+}
+function DocPageMetadata(props: Props): JSX.Element {
+  const {versionMetadata} = props;
+  return (
+    <>
+      <SearchMetadata
+        version={versionMetadata.version}
+        tag={docVersionSearchTag(
+          versionMetadata.pluginId,
+          versionMetadata.version,
+        )}
+      />
+      <PageMetadata>
+        {versionMetadata.noIndex && (

Review Comment:
   Search engine reindex pages periodically.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to