Skip to content

Commit 537b924

Browse files
committed
changelog fix
1 parent 148b32b commit 537b924

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/features/posts/components/Changelog/index.astro

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,12 @@ type Props = {
88
99
const { repo } = Astro.props
1010
const repoInfo = await getGitHubRepo(repo)
11-
if (!repoInfo) {
12-
console.error(`Repo ${repo} not found`)
13-
}
14-
const { url, object } = repoInfo
15-
const changelogHtml = await markdownToHtml(
16-
object.text.replace('### Changelog', '')
17-
)
11+
if (!repoInfo) console.error(`Repo ${repo} not found`)
12+
13+
const changelogHtml =
14+
repoInfo?.object != null
15+
? await markdownToHtml(repoInfo.object.text.replace('### Changelog', ''))
16+
: null
1817
---
1918

2019
{
@@ -24,7 +23,7 @@ const changelogHtml = await markdownToHtml(
2423
<div class={styles.changelog} id="changelog">
2524
<p class={styles.source}>
2625
sourced from{" "}
27-
<a href={`${url}/tree/main/CHANGELOG.md`}>
26+
<a href={`${repoInfo.url}/tree/main/CHANGELOG.md`}>
2827
<code>{`${repo}:CHANGELOG.md`}</code>
2928
</a>
3029
</p>

0 commit comments

Comments
 (0)