mirror of
https://github.com/Unleash/unleash.git
synced 2025-07-31 13:47:02 +02:00
Add search priority for auto-generated pages (#10386)
This commit is contained in:
parent
b663696bd4
commit
f363a1eba7
@ -68,6 +68,7 @@ Algolia is configured to use the `priority` attribute for custom ranking in desc
|
|||||||
We have a reusable React component, `<SearchPriority />` -> `src/components/SearchPriority.jsx`. This component provides a simple shortcut to add the correct <meta> tag to any .mdx page.
|
We have a reusable React component, `<SearchPriority />` -> `src/components/SearchPriority.jsx`. This component provides a simple shortcut to add the correct <meta> tag to any .mdx page.
|
||||||
|
|
||||||
For high priority pages, use `<SearchPriority level="high" />`. For pages referencing deprecated features use `<SearchPriority level="noindex" />`.
|
For high priority pages, use `<SearchPriority level="high" />`. For pages referencing deprecated features use `<SearchPriority level="noindex" />`.
|
||||||
|
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
|
## Troubleshooting
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ title: Environment import and export
|
|||||||
|
|
||||||
import SearchPriority from '@site/src/components/SearchPriority';
|
import SearchPriority from '@site/src/components/SearchPriority';
|
||||||
|
|
||||||
<SearchPriority level="high" />
|
<SearchPriority level="medium" />
|
||||||
|
|
||||||
|
|
||||||
import VideoContent from '@site/src/components/VideoContent.jsx'
|
import VideoContent from '@site/src/components/VideoContent.jsx'
|
||||||
|
@ -13,6 +13,7 @@ const DOCS = mapObject(enrich)({
|
|||||||
},
|
},
|
||||||
'unleash-edge': {
|
'unleash-edge': {
|
||||||
sidebarName: 'Unleash Edge',
|
sidebarName: 'Unleash Edge',
|
||||||
|
searchPriority: 'high',
|
||||||
slugName: 'unleash-edge',
|
slugName: 'unleash-edge',
|
||||||
subPages: {
|
subPages: {
|
||||||
'docs/concepts.md': {
|
'docs/concepts.md': {
|
||||||
|
@ -93,6 +93,14 @@ export const modifyContent =
|
|||||||
const subpageKey = filename.replace(`${data.name}/${data.branch}/`, '');
|
const subpageKey = filename.replace(`${data.name}/${data.branch}/`, '');
|
||||||
const subpage = data.subPages?.[subpageKey];
|
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<SearchPriority level="${priorityLevel}" />`
|
||||||
|
: '';
|
||||||
const generationTime = new Date();
|
const generationTime = new Date();
|
||||||
|
|
||||||
const processedFilename = (() => {
|
const processedFilename = (() => {
|
||||||
@ -134,6 +142,8 @@ custom_edit_url: ${data.repoUrl}/edit/${data.branch}/${
|
|||||||
}
|
}
|
||||||
---
|
---
|
||||||
|
|
||||||
|
${priorityComponent}
|
||||||
|
|
||||||
:::info Generated content
|
:::info Generated content
|
||||||
This document was generated from ${
|
This document was generated from ${
|
||||||
subpage ? subpageKey : 'README.md'
|
subpage ? subpageKey : 'README.md'
|
||||||
|
Loading…
Reference in New Issue
Block a user