mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
docs: use a number of documented versions for indexing (#9424)
This PR allows Algolia to index on the number of documented versions rather than on the global version of packages. Fixed: #9329
This commit is contained in:
parent
68c53df75f
commit
f0951aaf3b
944
website/package-lock.json
generated
944
website/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -15,9 +15,9 @@
|
|||||||
"archive": "node archive.js"
|
"archive": "node archive.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@docusaurus/core": "2.1.0",
|
"@docusaurus/core": "2.2.0",
|
||||||
"@docusaurus/plugin-client-redirects": "2.1.0",
|
"@docusaurus/plugin-client-redirects": "2.2.0",
|
||||||
"@docusaurus/preset-classic": "2.1.0",
|
"@docusaurus/preset-classic": "2.2.0",
|
||||||
"@mdx-js/react": "1.6.22",
|
"@mdx-js/react": "1.6.22",
|
||||||
"clsx": "1.2.1",
|
"clsx": "1.2.1",
|
||||||
"prism-react-renderer": "1.3.5",
|
"prism-react-renderer": "1.3.5",
|
||||||
@ -25,7 +25,7 @@
|
|||||||
"react-dom": "17.0.2"
|
"react-dom": "17.0.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@docusaurus/module-type-aliases": "2.1.0",
|
"@docusaurus/module-type-aliases": "2.2.0",
|
||||||
"swc-loader": "0.2.3"
|
"swc-loader": "0.2.3"
|
||||||
},
|
},
|
||||||
"browserslist": {
|
"browserslist": {
|
||||||
|
26
website/src/theme/SearchMetadata/index.js
Normal file
26
website/src/theme/SearchMetadata/index.js
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import Head from '@docusaurus/Head';
|
||||||
|
|
||||||
|
// Tracks the global package version as a local, monotonic counter. This
|
||||||
|
// prevents Algolia from deleting based on differing package versions and
|
||||||
|
// instead delete based on the number of versions we intend to keep documented.
|
||||||
|
let globalCounter = -1;
|
||||||
|
const versionToCounter = new Map();
|
||||||
|
|
||||||
|
export default function SearchMetadata({locale, version}) {
|
||||||
|
const language = locale;
|
||||||
|
let counter;
|
||||||
|
if (version) {
|
||||||
|
counter = versionToCounter.get(version);
|
||||||
|
if (!counter) {
|
||||||
|
counter = ++globalCounter;
|
||||||
|
versionToCounter.set(version, counter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<Head>
|
||||||
|
{language && <meta name="docsearch:language" content={language} />}
|
||||||
|
{counter && <meta name="docsearch:counter" content={counter} />}
|
||||||
|
</Head>
|
||||||
|
);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user