diff --git a/src/components/Toc/index.tsx b/src/components/Toc/index.tsx index 48c1016..06350f5 100644 --- a/src/components/Toc/index.tsx +++ b/src/components/Toc/index.tsx @@ -23,7 +23,14 @@ function extractTitle(title: string): ITitle { } export const Toc: FC = ({ header, items }) => { - const { pathname } = window.location + const windowGlobal = typeof window !== "undefined" && window + + // window is not available on build + if (!windowGlobal) { + return null + } + + const { pathname } = windowGlobal.location return ( {header}