Skip to content

Commit

Permalink
Include substack into articles
Browse files Browse the repository at this point in the history
  • Loading branch information
puria committed Oct 1, 2023
1 parent 389fceb commit 5a4cf26
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/BlogArticlePreview.astro
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ const snippet = Astro.props['content:encodedSnippet'];
<p class="text-gray-800 text-sm font-medium mb-2 text-clip overflow-hidden max-h-20">
{snippet}
</p>
<Button href={link} text="Read on Medium.com" inverted={true} cls="mt-4 text-base no-underline" />
<Button href={link} text="Read all" inverted={true} cls="mt-4 text-base no-underline" />
</div>
</div>
7 changes: 5 additions & 2 deletions src/pages/blog/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import BlogArticlePreview from '~/components/BlogArticlePreview.astro';
import Parser from 'rss-parser';
const parser = new Parser();
const feed = await parser.parseURL('https://medium.com/feed/think-do-tank');
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());
---

<Layout
Expand All @@ -14,6 +17,6 @@ const feed = await parser.parseURL('https://medium.com/feed/think-do-tank');
}}
>
<div class="mt-8 grid grid-cols-1 md:grid-cols-2 gap-8">
{feed.items.map((f) => <BlogArticlePreview {...f} />)}
{feed.map((f) => <BlogArticlePreview {...f} />)}
</div>
</Layout>

0 comments on commit 5a4cf26

Please sign in to comment.