Skip to content

Commit 816fd9b

Browse files
authored
Merge pull request #257 from medyo/fix-hackernews-comments-url
fix: Hackernews comments url
2 parents 7ffd999 + 2fe1738 commit 816fd9b

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/features/cards/components/hackernewsCard/ArticleItem.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ const ArticleItem = (props: BaseItemPropsType<Article>) => {
4747
<MdAccessTime className="rowItemIcon" /> {format(new Date(item.published_at))}
4848
</span>
4949
<ClickableItem
50-
link={`https://news.ycombinator.com/item?id=${item.id}`}
50+
link={item.canonical_url || 'https://news.ycombinator.com/'}
5151
className="rowItem rowItemClickable"
5252
analyticsAttributes={{
5353
[Attributes.POINTS]: item.comments_count,
5454
[Attributes.TRIGERED_FROM]: 'card',
5555
[Attributes.TITLE]: `${item.title} comments`,
56-
[Attributes.LINK]: `https://news.ycombinator.com/item?id=${item.id}`,
56+
[Attributes.LINK]: item.canonical_url,
5757
[Attributes.SOURCE]: analyticsTag,
5858
}}>
5959
<BiCommentDetail className="rowItemIcon" /> {item.comments_count} comments

src/types/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export type BaseEntry = {
4242

4343
export type Article = BaseEntry & {
4444
source: string
45+
canonical_url?: string
4546
original_url?: string
4647
comments_url?: string
4748
}

0 commit comments

Comments
 (0)