Skip to content

Commit 2b68dba

Browse files
authored
Merge pull request #1029 from st3phhays/toc
(#1027) Make "Edit This Page" link valid
2 parents 38a03fc + 43ee831 commit 2b68dba

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/components/toc/TableOfContents.astro

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ interface Props {
88
}
99
1010
const { content } = Astro.props;
11-
const editLink = `https://github.com/${packageJson.author}/${packageJson.name}/edit/master/src/content${Astro.url.pathname}.mdx`;
11+
const filePath = Astro.url.pathname.endsWith('/') ? Astro.url.pathname.slice(0, -1) : Astro.url.pathname;
12+
const editLink = `https://github.com/${packageJson.author}/${packageJson.name}/edit/master/src/content/docs${filePath}.mdx`;
1213
---
1314

1415
{(content && content.length > 0) && (

0 commit comments

Comments
 (0)