initial: Astro port of ViralMVP with favicon + SEO redirects
This commit is contained in:
20
src/components/Pagination.astro
Normal file
20
src/components/Pagination.astro
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
const { page, basePath = '/' } = Astro.props;
|
||||
const hasPrev = page.url.prev;
|
||||
const hasNext = page.url.next;
|
||||
---
|
||||
{page.lastPage > 1 && (
|
||||
<nav class="pagination">
|
||||
{hasPrev ? (
|
||||
<a href={page.url.prev} class="pagination-link">← Newer Posts</a>
|
||||
) : <span />}
|
||||
|
||||
<span class="pagination-info">
|
||||
Page {page.currentPage} of {page.lastPage} ({page.total} posts)
|
||||
</span>
|
||||
|
||||
{hasNext ? (
|
||||
<a href={page.url.next} class="pagination-link">Older Posts →</a>
|
||||
) : <span />}
|
||||
</nav>
|
||||
)}
|
||||
23
src/components/PostList.astro
Normal file
23
src/components/PostList.astro
Normal file
@@ -0,0 +1,23 @@
|
||||
---
|
||||
const { posts, tag } = Astro.props;
|
||||
---
|
||||
{tag && <h2 style="margin-bottom: 20px;">Tagged: {tag}</h2>}
|
||||
|
||||
{posts.map((post) => (
|
||||
<article class="post">
|
||||
<h2 class="post-title">
|
||||
<a href={`/${post.slug}/`}>{post.title}</a>
|
||||
</h2>
|
||||
<div class="post-meta">
|
||||
{new Date(post.date).toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' })}
|
||||
{post.tags.map((t) => (
|
||||
<span class="tag"><a href={`/tag/${t}/`}>{t}</a></span>
|
||||
))}
|
||||
</div>
|
||||
<p class="post-excerpt">{post.rawExcerpt}</p>
|
||||
</article>
|
||||
))}
|
||||
|
||||
{posts.length === 0 && (
|
||||
<p style="color: #999; text-align: center; padding: 50px 0;">No posts yet.</p>
|
||||
)}
|
||||
Reference in New Issue
Block a user