fix(examples): use correct URL for Ask HN posts (#4640)

pull/4685/head
Robin Cussol 4 years ago committed by GitHub
parent d7497deaec
commit df3ae85b42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -3,6 +3,8 @@
export let item;
export let returnTo;
$: url = !item.domain ? `https://news.ycombinator.com/${item.url}` : item.url;
</script>
<style>
@ -24,7 +26,7 @@
<a href={returnTo}>&laquo; back</a>
<article>
<a href="{item.url}">
<a href="{url}">
<h1>{item.title}</h1>
<small>{item.domain}</small>
</a>
@ -36,4 +38,4 @@
{#each item.comments as comment}
<Comment {comment}/>
{/each}
</div>
</div>

@ -7,6 +7,8 @@
const c = item.comments_count;
return `${c} ${c === 1 ? 'comment' : 'comments'}`;
}
$: url = item.type === "ask" ? `https://news.ycombinator.com/${item.url}` : item.url;
</script>
<style>
@ -33,6 +35,6 @@
<article>
<span>{i + offset + 1}</span>
<h2><a target="_blank" href={item.url}>{item.title}</a></h2>
<h2><a target="_blank" href={url}>{item.title}</a></h2>
<p class="meta"><a href="#/item/{item.id}">{comment_text()}</a> by {item.user} {item.time_ago}</p>
</article>
</article>

Loading…
Cancel
Save