diff --git a/website/README.md b/website/README.md index 59cb504cd7..0f77e86a76 100644 --- a/website/README.md +++ b/website/README.md @@ -68,6 +68,7 @@ Algolia is configured to use the `priority` attribute for custom ranking in desc We have a reusable React component, `` -> `src/components/SearchPriority.jsx`. This component provides a simple shortcut to add the correct tag to any .mdx page. For high priority pages, use ``. For pages referencing deprecated features use ``. +For autogenerated pages, use `searchPriority: 'high'` key-value pair in the document definition of the file (works at the root level or for individual subpages). See `website/remote-content/edge-proxy.js` as an example. ## Troubleshooting diff --git a/website/docs/how-to/how-to-environment-import-export.mdx b/website/docs/how-to/how-to-environment-import-export.mdx index ffef95a82e..4d15475ae1 100644 --- a/website/docs/how-to/how-to-environment-import-export.mdx +++ b/website/docs/how-to/how-to-environment-import-export.mdx @@ -5,7 +5,7 @@ title: Environment import and export import SearchPriority from '@site/src/components/SearchPriority'; - + import VideoContent from '@site/src/components/VideoContent.jsx' diff --git a/website/remote-content/edge-proxy.js b/website/remote-content/edge-proxy.js index 64c34060a3..aef838d0ec 100644 --- a/website/remote-content/edge-proxy.js +++ b/website/remote-content/edge-proxy.js @@ -13,6 +13,7 @@ const DOCS = mapObject(enrich)({ }, 'unleash-edge': { sidebarName: 'Unleash Edge', + searchPriority: 'high', slugName: 'unleash-edge', subPages: { 'docs/concepts.md': { diff --git a/website/remote-content/shared.js b/website/remote-content/shared.js index eec004cfc6..9e45e0fae0 100644 --- a/website/remote-content/shared.js +++ b/website/remote-content/shared.js @@ -93,6 +93,14 @@ export const modifyContent = const subpageKey = filename.replace(`${data.name}/${data.branch}/`, ''); const subpage = data.subPages?.[subpageKey]; + // Add search the priority level. Use the sub-page's priority if it exists, + // otherwise fall back to the main repository's priority. + const priorityLevel = subpage?.searchPriority ?? data.searchPriority; + + // Create the component string, but only if a priority level was defined. + const priorityComponent = priorityLevel + ? `import SearchPriority from '@site/src/components/SearchPriority';\n\n` + : ''; const generationTime = new Date(); const processedFilename = (() => { @@ -134,6 +142,8 @@ custom_edit_url: ${data.repoUrl}/edit/${data.branch}/${ } --- +${priorityComponent} + :::info Generated content This document was generated from ${ subpage ? subpageKey : 'README.md'