Skip to content

Commit

Permalink
feat: link directly to gh edit interface (#1039)
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenFluin authored Jul 9, 2024
1 parent 7901898 commit fcce191
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/scripts/github-edit.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import type { AstroGlobal } from 'astro';
import type { AstroGlobal } from "astro";

/** Gets the URL to edit the page on GitHub */

export function getGithubEditUrl(Astro: Readonly<AstroGlobal>) {
const { content = {} } = Astro.props;
let currentPage = Astro.url.pathname;
if(currentPage == "/") {
return `https://github.com/axelarnetwork/axelar-docs/blob/main/src/pages/index.astro`;
}
return `https://github.com/axelarnetwork/axelar-docs/blob/main/src/pages${currentPage.replace(/\/$/, '')}.mdx`;

}
const { content = {} } = Astro.props;
let currentPage = Astro.url.pathname;
if (currentPage == "/") {
return `https://github.com/axelarnetwork/axelar-docs/blob/main/src/pages/index.astro`;
}
return `https://github.com/axelarnetwork/axelar-docs/edit/main/src/pages${currentPage.replace(
/\/$/,
""
)}.mdx`;
}

0 comments on commit fcce191

Please sign in to comment.