fix: right sidebar anchors earlier
This commit is contained in:
parent
b001d1d0f1
commit
64b8fd9584
2 changed files with 2 additions and 2 deletions
|
|
@ -9,7 +9,8 @@ type Props = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const { headings, githubEditUrl } = Astro.props as 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">
|
<nav aria-labelledby="grid-right" class="w-64 text-foreground">
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ const TableOfContents: FunctionalComponent<{ headings: MarkdownHeading[]; curren
|
||||||
currentPage,
|
currentPage,
|
||||||
}) => {
|
}) => {
|
||||||
// remove slash before #
|
// remove slash before #
|
||||||
currentPage = currentPage.endsWith('/') ? currentPage.slice(0, -1) : currentPage;
|
|
||||||
const toc = useRef<any>();
|
const toc = useRef<any>();
|
||||||
const onThisPageID = 'on-this-page-heading';
|
const onThisPageID = 'on-this-page-heading';
|
||||||
const itemOffsets = useRef<ItemOffsets[]>([]);
|
const itemOffsets = useRef<ItemOffsets[]>([]);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue