Skip to content

Commit

Permalink
fix: show external links hostname is broken-link-checker (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
ndom91 authored Jul 13, 2024
1 parent 56a9ebb commit 998ea25
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion .github/broken-link-checker/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,15 @@ const generateOutputMd = (output: Output): string => {

// @ts-expect-error
links.forEach((link: TODO) => {
outputMd += `| [${new URL(link.url.resolved).pathname}](${
const siteUrl = process.env.VERCEL_PREVIEW_URL || "https://docs.gitbutler.com"

// Show paths for internal links only and include hostnames for external links
const targetLinkText =
new URL(link.url.resolved).hostname === new URL(siteUrl).hostname
? new URL(link.url.resolved).pathname
: link.url.resolved

outputMd += `| [${targetLinkText}](${
link.url.resolved
}) | "${link.html?.text?.trim().replaceAll("\n", "")}" | ${link.brokenReason} |
`
Expand Down
2 changes: 1 addition & 1 deletion content/docs/releases.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Download bins from https://gitbutler.com/

---

Join our Discord [#releases](https://discord.com/channels/1060193121130000425/1183737922785116161) channel.
Join our Discord [#releases](https://discord.com/channels/1060193121130000425/1183737922785116161) channel

<Cards>
<Card
Expand Down

0 comments on commit 998ea25

Please sign in to comment.