fix: right sidebar anchors earlier

This commit is contained in:
Felix Roos 2023-02-13 00:41:42 +01:00
parent b001d1d0f1
commit 64b8fd9584
2 changed files with 2 additions and 2 deletions

View File

@ -9,7 +9,8 @@ type Props = {
};
const { headings, githubEditUrl } = Astro.props as Props;
const currentPage = Astro.url.pathname;
let currentPage = Astro.url.pathname;
currentPage = currentPage.endsWith('/') ? currentPage.slice(0, -1) : currentPage;
---
<nav aria-labelledby="grid-right" class="w-64 text-foreground">

View File

@ -13,7 +13,6 @@ const TableOfContents: FunctionalComponent<{ headings: MarkdownHeading[]; curren
currentPage,
}) => {
// remove slash before #
currentPage = currentPage.endsWith('/') ? currentPage.slice(0, -1) : currentPage;
const toc = useRef<any>();
const onThisPageID = 'on-this-page-heading';
const itemOffsets = useRef<ItemOffsets[]>([]);