-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: link directly to gh edit interface (#1039)
- Loading branch information
1 parent
7901898
commit fcce191
Showing
1 changed file
with
11 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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`; | ||
} |