mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-22 14:49:29 +00:00
docs[minor]: Hide prev/next buttons on docs in how to / tutorials (#21789)
These buttons don't navigate to the proper prev/next page. Hide in those pages
This commit is contained in:
parent
8607735b80
commit
6febb283f6
22
docs/src/theme/DocPaginator/index.js
Normal file
22
docs/src/theme/DocPaginator/index.js
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
import React from "react";
|
||||||
|
import DocPaginator from "@theme-original/DocPaginator";
|
||||||
|
|
||||||
|
const BLACKLISTED_PATHS = ["/docs/how_to/", "/docs/tutorials/"];
|
||||||
|
|
||||||
|
export default function DocPaginatorWrapper(props) {
|
||||||
|
const [shouldHide, setShouldHide] = React.useState(false);
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
if (typeof window === "undefined") return;
|
||||||
|
const currentPath = window.location.pathname;
|
||||||
|
if (BLACKLISTED_PATHS.some((path) => currentPath.includes(path))) {
|
||||||
|
setShouldHide(true);
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
if (!shouldHide) {
|
||||||
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
||||||
|
return <DocPaginator {...props} />;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user