try hierarchical
This commit is contained in:
parent
32b8dff989
commit
3815ff5c1b
|
@ -5,3 +5,4 @@
|
||||||
package = "@algolia/netlify-plugin-crawler"
|
package = "@algolia/netlify-plugin-crawler"
|
||||||
[plugins.inputs]
|
[plugins.inputs]
|
||||||
renderJavaScript = true
|
renderJavaScript = true
|
||||||
|
template = "hierarchical"
|
|
@ -21,6 +21,7 @@
|
||||||
"@mdx-js/rollup": "^2.2.1",
|
"@mdx-js/rollup": "^2.2.1",
|
||||||
"@stefanprobst/rehype-extract-toc": "^2.2.0",
|
"@stefanprobst/rehype-extract-toc": "^2.2.0",
|
||||||
"@types/mdx": "^2.0.3",
|
"@types/mdx": "^2.0.3",
|
||||||
|
"algoliasearch": "^4.14.3",
|
||||||
"bootstrap": "4.5.3",
|
"bootstrap": "4.5.3",
|
||||||
"classnames": "^2.3.2",
|
"classnames": "^2.3.2",
|
||||||
"cron": "^2.2.0",
|
"cron": "^2.2.0",
|
||||||
|
|
16
src/App.tsx
16
src/App.tsx
|
@ -22,6 +22,10 @@ import { isProd } from "./lib/isProd";
|
||||||
import ReactGA from "react-ga";
|
import ReactGA from "react-ga";
|
||||||
import { useUser } from "./user-context";
|
import { useUser } from "./user-context";
|
||||||
import PrivacyPolicy from "./pages/PrivacyPolicy";
|
import PrivacyPolicy from "./pages/PrivacyPolicy";
|
||||||
|
import algoliasearch from "algoliasearch";
|
||||||
|
|
||||||
|
const client = algoliasearch('M5GQZF38JA', '1e3b529b909acf72fde1515f520f3913');
|
||||||
|
const index = client.initIndex('netlify_150beb8b-aae1-4cef-a05c-2add5d8904f7_master_all');
|
||||||
|
|
||||||
const chapters = content.reduce((chapters, item) => (
|
const chapters = content.reduce((chapters, item) => (
|
||||||
item.content
|
item.content
|
||||||
|
@ -36,6 +40,7 @@ if (isProd) {
|
||||||
|
|
||||||
function App(props: any) {
|
function App(props: any) {
|
||||||
const [navOpen, setNavOpen] = useState(false);
|
const [navOpen, setNavOpen] = useState(false);
|
||||||
|
const [search, setSearch] = useState("");
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { user } = useUser();
|
const { user } = useUser();
|
||||||
function logAnalytics() {
|
function logAnalytics() {
|
||||||
|
@ -59,6 +64,16 @@ function App(props: any) {
|
||||||
logAnalytics();
|
logAnalytics();
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
}, [window.location.pathname]);
|
}, [window.location.pathname]);
|
||||||
|
function handleSearch(s: string) {
|
||||||
|
setSearch(s);
|
||||||
|
index.search(s, {
|
||||||
|
attributesToSnippet: [
|
||||||
|
"content:20",
|
||||||
|
],
|
||||||
|
}).then(({ hits }) => {
|
||||||
|
console.log(hits);
|
||||||
|
});
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Header setNavOpen={setNavOpen} />
|
<Header setNavOpen={setNavOpen} />
|
||||||
|
@ -70,6 +85,7 @@ function App(props: any) {
|
||||||
setNavOpen={setNavOpen}
|
setNavOpen={setNavOpen}
|
||||||
pathname={window.location.pathname}
|
pathname={window.location.pathname}
|
||||||
/>
|
/>
|
||||||
|
<input type="text" onChange={e => handleSearch(e.target.value)} value={search} />
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route
|
<Route
|
||||||
path="/"
|
path="/"
|
||||||
|
|
124
yarn.lock
124
yarn.lock
|
@ -7,6 +7,110 @@
|
||||||
resolved "https://registry.yarnpkg.com/@adobe/css-tools/-/css-tools-4.1.0.tgz#417fef4a143f4396ad0b3b4351fee21323f15aa8"
|
resolved "https://registry.yarnpkg.com/@adobe/css-tools/-/css-tools-4.1.0.tgz#417fef4a143f4396ad0b3b4351fee21323f15aa8"
|
||||||
integrity sha512-mMVJ/j/GbZ/De4ZHWbQAQO1J6iVnjtZLc9WEdkUQb8S/Bu2cAF2bETXUgMAdvMG3/ngtKmcNBe+Zms9bg6jnQQ==
|
integrity sha512-mMVJ/j/GbZ/De4ZHWbQAQO1J6iVnjtZLc9WEdkUQb8S/Bu2cAF2bETXUgMAdvMG3/ngtKmcNBe+Zms9bg6jnQQ==
|
||||||
|
|
||||||
|
"@algolia/cache-browser-local-storage@4.14.3":
|
||||||
|
version "4.14.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/@algolia/cache-browser-local-storage/-/cache-browser-local-storage-4.14.3.tgz#b9e0da012b2f124f785134a4d468ee0841b2399d"
|
||||||
|
integrity sha512-hWH1yCxgG3+R/xZIscmUrWAIBnmBFHH5j30fY/+aPkEZWt90wYILfAHIOZ1/Wxhho5SkPfwFmT7ooX2d9JeQBw==
|
||||||
|
dependencies:
|
||||||
|
"@algolia/cache-common" "4.14.3"
|
||||||
|
|
||||||
|
"@algolia/cache-common@4.14.3":
|
||||||
|
version "4.14.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/@algolia/cache-common/-/cache-common-4.14.3.tgz#a78e9faee3dfec018eab7b0996e918e06b476ac7"
|
||||||
|
integrity sha512-oZJofOoD9FQOwiGTzyRnmzvh3ZP8WVTNPBLH5xU5JNF7drDbRT0ocVT0h/xB2rPHYzOeXRrLaQQBwRT/CKom0Q==
|
||||||
|
|
||||||
|
"@algolia/cache-in-memory@4.14.3":
|
||||||
|
version "4.14.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/@algolia/cache-in-memory/-/cache-in-memory-4.14.3.tgz#96cefb942aeb80e51e6a7e29f25f4f7f3439b736"
|
||||||
|
integrity sha512-ES0hHQnzWjeioLQf5Nq+x1AWdZJ50znNPSH3puB/Y4Xsg4Av1bvLmTJe7SY2uqONaeMTvL0OaVcoVtQgJVw0vg==
|
||||||
|
dependencies:
|
||||||
|
"@algolia/cache-common" "4.14.3"
|
||||||
|
|
||||||
|
"@algolia/client-account@4.14.3":
|
||||||
|
version "4.14.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/@algolia/client-account/-/client-account-4.14.3.tgz#6d7d032a65c600339ce066505c77013d9a9e4966"
|
||||||
|
integrity sha512-PBcPb0+f5Xbh5UfLZNx2Ow589OdP8WYjB4CnvupfYBrl9JyC1sdH4jcq/ri8osO/mCZYjZrQsKAPIqW/gQmizQ==
|
||||||
|
dependencies:
|
||||||
|
"@algolia/client-common" "4.14.3"
|
||||||
|
"@algolia/client-search" "4.14.3"
|
||||||
|
"@algolia/transporter" "4.14.3"
|
||||||
|
|
||||||
|
"@algolia/client-analytics@4.14.3":
|
||||||
|
version "4.14.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/@algolia/client-analytics/-/client-analytics-4.14.3.tgz#ca409d00a8fff98fdcc215dc96731039900055dc"
|
||||||
|
integrity sha512-eAwQq0Hb/aauv9NhCH5Dp3Nm29oFx28sayFN2fdOWemwSeJHIl7TmcsxVlRsO50fsD8CtPcDhtGeD3AIFLNvqw==
|
||||||
|
dependencies:
|
||||||
|
"@algolia/client-common" "4.14.3"
|
||||||
|
"@algolia/client-search" "4.14.3"
|
||||||
|
"@algolia/requester-common" "4.14.3"
|
||||||
|
"@algolia/transporter" "4.14.3"
|
||||||
|
|
||||||
|
"@algolia/client-common@4.14.3":
|
||||||
|
version "4.14.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/@algolia/client-common/-/client-common-4.14.3.tgz#c44e48652b2121a20d7a40cfd68d095ebb4191a8"
|
||||||
|
integrity sha512-jkPPDZdi63IK64Yg4WccdCsAP4pHxSkr4usplkUZM5C1l1oEpZXsy2c579LQ0rvwCs5JFmwfNG4ahOszidfWPw==
|
||||||
|
dependencies:
|
||||||
|
"@algolia/requester-common" "4.14.3"
|
||||||
|
"@algolia/transporter" "4.14.3"
|
||||||
|
|
||||||
|
"@algolia/client-personalization@4.14.3":
|
||||||
|
version "4.14.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/@algolia/client-personalization/-/client-personalization-4.14.3.tgz#8f71325035aa2a5fa7d1d567575235cf1d6c654f"
|
||||||
|
integrity sha512-UCX1MtkVNgaOL9f0e22x6tC9e2H3unZQlSUdnVaSKpZ+hdSChXGaRjp2UIT7pxmPqNCyv51F597KEX5WT60jNg==
|
||||||
|
dependencies:
|
||||||
|
"@algolia/client-common" "4.14.3"
|
||||||
|
"@algolia/requester-common" "4.14.3"
|
||||||
|
"@algolia/transporter" "4.14.3"
|
||||||
|
|
||||||
|
"@algolia/client-search@4.14.3":
|
||||||
|
version "4.14.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/@algolia/client-search/-/client-search-4.14.3.tgz#cf1e77549f5c3e73408ffe6441ede985fde69da0"
|
||||||
|
integrity sha512-I2U7xBx5OPFdPLA8AXKUPPxGY3HDxZ4r7+mlZ8ZpLbI8/ri6fnu6B4z3wcL7sgHhDYMwnAE8Xr0AB0h3Hnkp4A==
|
||||||
|
dependencies:
|
||||||
|
"@algolia/client-common" "4.14.3"
|
||||||
|
"@algolia/requester-common" "4.14.3"
|
||||||
|
"@algolia/transporter" "4.14.3"
|
||||||
|
|
||||||
|
"@algolia/logger-common@4.14.3":
|
||||||
|
version "4.14.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/@algolia/logger-common/-/logger-common-4.14.3.tgz#87d4725e7f56ea5a39b605771b7149fff62032a7"
|
||||||
|
integrity sha512-kUEAZaBt/J3RjYi8MEBT2QEexJR2kAE2mtLmezsmqMQZTV502TkHCxYzTwY2dE7OKcUTxi4OFlMuS4GId9CWPw==
|
||||||
|
|
||||||
|
"@algolia/logger-console@4.14.3":
|
||||||
|
version "4.14.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/@algolia/logger-console/-/logger-console-4.14.3.tgz#1f19f8f0a5ef11f01d1f9545290eb6a89b71fb8a"
|
||||||
|
integrity sha512-ZWqAlUITktiMN2EiFpQIFCJS10N96A++yrexqC2Z+3hgF/JcKrOxOdT4nSCQoEPvU4Ki9QKbpzbebRDemZt/hw==
|
||||||
|
dependencies:
|
||||||
|
"@algolia/logger-common" "4.14.3"
|
||||||
|
|
||||||
|
"@algolia/requester-browser-xhr@4.14.3":
|
||||||
|
version "4.14.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/@algolia/requester-browser-xhr/-/requester-browser-xhr-4.14.3.tgz#bcf55cba20f58fd9bc95ee55793b5219f3ce8888"
|
||||||
|
integrity sha512-AZeg2T08WLUPvDncl2XLX2O67W5wIO8MNaT7z5ii5LgBTuk/rU4CikTjCe2xsUleIZeFl++QrPAi4Bdxws6r/Q==
|
||||||
|
dependencies:
|
||||||
|
"@algolia/requester-common" "4.14.3"
|
||||||
|
|
||||||
|
"@algolia/requester-common@4.14.3":
|
||||||
|
version "4.14.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/@algolia/requester-common/-/requester-common-4.14.3.tgz#2d02fbe01afb7ae5651ae8dfe62d6c089f103714"
|
||||||
|
integrity sha512-RrRzqNyKFDP7IkTuV3XvYGF9cDPn9h6qEDl595lXva3YUk9YSS8+MGZnnkOMHvjkrSCKfoLeLbm/T4tmoIeclw==
|
||||||
|
|
||||||
|
"@algolia/requester-node-http@4.14.3":
|
||||||
|
version "4.14.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/@algolia/requester-node-http/-/requester-node-http-4.14.3.tgz#72389e1c2e5d964702451e75e368eefe85a09d8f"
|
||||||
|
integrity sha512-O5wnPxtDRPuW2U0EaOz9rMMWdlhwP0J0eSL1Z7TtXF8xnUeeUyNJrdhV5uy2CAp6RbhM1VuC3sOJcIR6Av+vbA==
|
||||||
|
dependencies:
|
||||||
|
"@algolia/requester-common" "4.14.3"
|
||||||
|
|
||||||
|
"@algolia/transporter@4.14.3":
|
||||||
|
version "4.14.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/@algolia/transporter/-/transporter-4.14.3.tgz#5593036bd9cf2adfd077fdc3e81d2e6118660a7a"
|
||||||
|
integrity sha512-2qlKlKsnGJ008exFRb5RTeTOqhLZj0bkMCMVskxoqWejs2Q2QtWmsiH98hDfpw0fmnyhzHEt0Z7lqxBYp8bW2w==
|
||||||
|
dependencies:
|
||||||
|
"@algolia/cache-common" "4.14.3"
|
||||||
|
"@algolia/logger-common" "4.14.3"
|
||||||
|
"@algolia/requester-common" "4.14.3"
|
||||||
|
|
||||||
"@ampproject/remapping@^2.1.0":
|
"@ampproject/remapping@^2.1.0":
|
||||||
version "2.2.0"
|
version "2.2.0"
|
||||||
resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.2.0.tgz#56c133824780de3174aed5ab6834f3026790154d"
|
resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.2.0.tgz#56c133824780de3174aed5ab6834f3026790154d"
|
||||||
|
@ -1788,6 +1892,26 @@ ajv@^8.6.0:
|
||||||
require-from-string "^2.0.2"
|
require-from-string "^2.0.2"
|
||||||
uri-js "^4.2.2"
|
uri-js "^4.2.2"
|
||||||
|
|
||||||
|
algoliasearch@^4.14.3:
|
||||||
|
version "4.14.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/algoliasearch/-/algoliasearch-4.14.3.tgz#f02a77a4db17de2f676018938847494b692035e7"
|
||||||
|
integrity sha512-GZTEuxzfWbP/vr7ZJfGzIl8fOsoxN916Z6FY2Egc9q2TmZ6hvq5KfAxY89pPW01oW/2HDEKA8d30f9iAH9eXYg==
|
||||||
|
dependencies:
|
||||||
|
"@algolia/cache-browser-local-storage" "4.14.3"
|
||||||
|
"@algolia/cache-common" "4.14.3"
|
||||||
|
"@algolia/cache-in-memory" "4.14.3"
|
||||||
|
"@algolia/client-account" "4.14.3"
|
||||||
|
"@algolia/client-analytics" "4.14.3"
|
||||||
|
"@algolia/client-common" "4.14.3"
|
||||||
|
"@algolia/client-personalization" "4.14.3"
|
||||||
|
"@algolia/client-search" "4.14.3"
|
||||||
|
"@algolia/logger-common" "4.14.3"
|
||||||
|
"@algolia/logger-console" "4.14.3"
|
||||||
|
"@algolia/requester-browser-xhr" "4.14.3"
|
||||||
|
"@algolia/requester-common" "4.14.3"
|
||||||
|
"@algolia/requester-node-http" "4.14.3"
|
||||||
|
"@algolia/transporter" "4.14.3"
|
||||||
|
|
||||||
ansi-regex@^5.0.1:
|
ansi-regex@^5.0.1:
|
||||||
version "5.0.1"
|
version "5.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304"
|
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304"
|
||||||
|
|
Loading…
Reference in New Issue