Link /articles article cards to their original source
Passes linkToOriginal to ArticleCard on the Articles page, same as the Dashboard already does, and makes ArticleCard's expanded-view "Read full" fallback link respect linkToOriginal too (it previously always pointed at the internal reader regardless of the prop). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
49597d1 parent: b954666 modified
web/src/lib/components/ArticleCard.svelte +7 -2 | @@ -169,8 +169,13 @@ | ||
| 169 | 169 | </div> |
| 170 | 170 | {:else} |
| 171 | 171 | <div class="p-4 pt-0"> |
| 172 | - <a href="/articles/{article.id}{navSuffix}" class="btn" | |
| 173 | - >Read full →</a | |
| 172 | + <a | |
| 173 | + href={linkToOriginal | |
| 174 | + ? article.url | |
| 175 | + : `/articles/${article.id}${navSuffix}`} | |
| 176 | + target={linkToOriginal ? "_blank" : undefined} | |
| 177 | + rel={linkToOriginal ? "noopener noreferrer" : undefined} | |
| 178 | + class="btn">Read full →</a | |
| 174 | 179 | > |
| 175 | 180 | </div> |
| 176 | 181 | {/if} |
| @@ -169,8 +169,13 @@ | |||
| 169 | </div> | 169 | </div> |
| 170 | {:else} | 170 | {:else} |
| 171 | <div class="p-4 pt-0"> | 171 | <div class="p-4 pt-0"> |
| 172 | - <a href="/articles/{article.id}{navSuffix}" class="btn" | 172 | + <a |
| 173 | - >Read full →</a | 173 | + href={linkToOriginal |
| 174 | + ? article.url | ||
| 175 | + : `/articles/${article.id}${navSuffix}`} | ||
| 176 | + target={linkToOriginal ? "_blank" : undefined} | ||
| 177 | + rel={linkToOriginal ? "noopener noreferrer" : undefined} | ||
| 178 | + class="btn">Read full →</a | ||
| 174 | > | 179 | > |
| 175 | </div> | 180 | </div> |
| 176 | {/if} | 181 | {/if} |
modified
web/src/routes/articles/+page.svelte +1 -0 | @@ -311,6 +311,7 @@ | ||
| 311 | 311 | article={a} |
| 312 | 312 | expanded={data.expanded_view} |
| 313 | 313 | navSuffix="?liked=1" |
| 314 | + linkToOriginal | |
| 314 | 315 | /> |
| 315 | 316 | </div> |
| 316 | 317 | {/each} |
| @@ -311,6 +311,7 @@ | |||
| 311 | article={a} | 311 | article={a} |
| 312 | expanded={data.expanded_view} | 312 | expanded={data.expanded_view} |
| 313 | navSuffix="?liked=1" | 313 | navSuffix="?liked=1" |
| 314 | + linkToOriginal | ||
| 314 | /> | 315 | /> |
| 315 | </div> | 316 | </div> |
| 316 | {/each} | 317 | {/each} |