Skip to content

Commit 2fb2a7c

Browse files
committed
fix: Make "edit this page" link to correct page
1 parent c85e584 commit 2fb2a7c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

gatsby-node.mjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,9 @@ const createPage = async (
180180
// on the page. this is used for policy pages as well as some index pages that don't
181181
// have any editable content
182182
if (frontmatter.edit_on_github !== false) {
183-
context.editUrl = getRepo(path, frontmatter).replace(`https://github.com/{nwo}/edit/{branch}/{path}`)
183+
const repo = getRepo(path, frontmatter)
184+
// Use the repo.replace method to ensure the URL tokens are properly replaced
185+
context.editUrl = repo.replace(`https://github.com/{nwo}/edit/{branch}/{path}`)
184186
Object.assign(context, await fetchContributors(path, frontmatter, {reporter, octokit}))
185187
}
186188

0 commit comments

Comments
 (0)