fix: missing toc if base url is set (#550)
* fix missing toc if base url is set * sort imports
This commit is contained in:
parent
a7a053e42a
commit
2b9e9ff903
1 changed files with 2 additions and 2 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
---
|
---
|
||||||
import type { MarkdownHeading } from "astro";
|
import type { MarkdownHeading } from "astro";
|
||||||
import { siteConfig } from "../../config";
|
import { siteConfig } from "../../config";
|
||||||
|
import { url } from "../../utils/url-utils";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
class?: string;
|
class?: string;
|
||||||
|
|
@ -15,8 +16,7 @@ for (const heading of headings) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const className = Astro.props.class;
|
const className = Astro.props.class;
|
||||||
|
const isPostsRoute = Astro.url.pathname.startsWith(url("/posts/"));
|
||||||
const isPostsRoute = Astro.url.pathname.startsWith("/posts/");
|
|
||||||
|
|
||||||
const removeTailingHash = (text: string) => {
|
const removeTailingHash = (text: string) => {
|
||||||
let lastIndexOfHash = text.lastIndexOf("#");
|
let lastIndexOfHash = text.lastIndexOf("#");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue