Skip to content

Commit

Permalink
fix: typography on blog previews and add ellipsis
Browse files Browse the repository at this point in the history
  • Loading branch information
puria committed Nov 9, 2023
1 parent 0199139 commit 71cc2c7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/pages/blog/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ const medium = await parser.parseURL('https://medium.com/feed/think-do-tank');
const planet = await parser.parseURL('https://dyne.substack.com/feed/');
const feed = medium.items.concat(planet.items);
feed.sort((a, b) => new Date(b.isoDate).getTime() - new Date(a.isoDate).getTime());
const truncate = (t, max) => t.substr(0, max - 1) + (t.length > max ? '' : '');
---

<Layout
Expand All @@ -20,7 +22,7 @@ feed.sort((a, b) => new Date(b.isoDate).getTime() - new Date(a.isoDate).getTime(
{
feed.map((f) => (
<BlogCard title={f.title} author={f.creator} href={f.link}>
{f.content}
{truncate(f['content:encodedSnippet'], 430)}
</BlogCard>
))
}
Expand Down

0 comments on commit 71cc2c7

Please sign in to comment.