|
| 1 | +--- |
| 2 | +import Base from '../../layouts/Base.astro'; |
| 3 | +
|
| 4 | +const posts = await Astro.glob('./*.md'); |
| 5 | +const sorted = posts |
| 6 | + .filter(p => p.frontmatter?.title) |
| 7 | + .sort((a, b) => { |
| 8 | + // Sort by date desc, then title alpha for undated |
| 9 | + const da = a.frontmatter.publishedAt ? new Date(a.frontmatter.publishedAt).getTime() : 0; |
| 10 | + const db = b.frontmatter.publishedAt ? new Date(b.frontmatter.publishedAt).getTime() : 0; |
| 11 | + if (da !== db) return db - da; |
| 12 | + return (a.frontmatter.title || '').localeCompare(b.frontmatter.title || ''); |
| 13 | + }); |
| 14 | +
|
| 15 | +// Group by year-month for scannable sections |
| 16 | +const byMonth: Record<string, typeof sorted> = {}; |
| 17 | +for (const post of sorted) { |
| 18 | + const raw = post.frontmatter.publishedAt; |
| 19 | + const key = raw |
| 20 | + ? new Date(raw).toLocaleDateString('en-US', { year: 'numeric', month: 'long' }) |
| 21 | + : 'Undated'; |
| 22 | + if (!byMonth[key]) byMonth[key] = []; |
| 23 | + byMonth[key].push(post); |
| 24 | +} |
| 25 | +--- |
| 26 | +<Base |
| 27 | + title="Blog Archive — Every SocialProof Post" |
| 28 | + description="Complete archive of all SocialProof blog posts: testimonial guides, social proof strategies, comparisons, and how-tos for small business owners." |
| 29 | + canonical="https://socialproof.dev/blog/archive" |
| 30 | +> |
| 31 | + <style> |
| 32 | + *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; } |
| 33 | + :root { |
| 34 | + --purple: #6c5ce7; |
| 35 | + --purple-light: #a29bfe; |
| 36 | + --dark: #0f0e17; |
| 37 | + --text: #e0dff5; |
| 38 | + --muted: #9b9ab8; |
| 39 | + --mid: #1a1929; |
| 40 | + --border: #2e2c47; |
| 41 | + } |
| 42 | + body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--dark); color: var(--text); line-height: 1.6; } |
| 43 | + a { color: var(--purple-light); text-decoration: none; } |
| 44 | + a:hover { text-decoration: underline; } |
| 45 | + |
| 46 | + nav { background: var(--dark); border-bottom: 1px solid var(--border); padding: 1rem 2rem; display: flex; align-items: center; justify-content: space-between; } |
| 47 | + .nav-logo { font-size: 1.2rem; font-weight: 800; color: var(--text); letter-spacing: -0.5px; } |
| 48 | + .nav-logo span { color: var(--purple-light); } |
| 49 | + .nav-cta { background: var(--purple); color: #fff; padding: 0.5rem 1.25rem; border-radius: 8px; font-weight: 600; font-size: 0.9rem; } |
| 50 | + .nav-cta:hover { background: var(--purple-light); text-decoration: none; } |
| 51 | + |
| 52 | + .hero { max-width: 760px; margin: 0 auto; padding: 4rem 2rem 2rem; } |
| 53 | + h1 { font-size: 2rem; font-weight: 800; margin-bottom: 0.5rem; } |
| 54 | + .sub { color: var(--muted); margin-bottom: 0.5rem; } |
| 55 | + .back-link { display: inline-block; color: var(--muted); font-size: 0.9rem; margin-bottom: 2rem; } |
| 56 | + .back-link:hover { color: var(--purple-light); } |
| 57 | + |
| 58 | + .archive { max-width: 760px; margin: 0 auto; padding: 0 2rem 5rem; } |
| 59 | + .month-group { margin-bottom: 2.5rem; } |
| 60 | + .month-label { |
| 61 | + font-size: 0.75rem; |
| 62 | + font-weight: 700; |
| 63 | + text-transform: uppercase; |
| 64 | + letter-spacing: 0.1em; |
| 65 | + color: var(--muted); |
| 66 | + border-bottom: 1px solid var(--border); |
| 67 | + padding-bottom: 0.5rem; |
| 68 | + margin-bottom: 0.75rem; |
| 69 | + } |
| 70 | + .post-list { list-style: none; } |
| 71 | + .post-list li { padding: 0.35rem 0; border-bottom: 1px solid rgba(46,44,71,0.5); display: flex; align-items: baseline; gap: 0.75rem; } |
| 72 | + .post-list li:last-child { border-bottom: none; } |
| 73 | + .post-date { font-size: 0.8rem; color: var(--muted); white-space: nowrap; flex-shrink: 0; } |
| 74 | + .post-list a { font-size: 0.95rem; color: var(--text); } |
| 75 | + .post-list a:hover { color: var(--purple-light); } |
| 76 | + |
| 77 | + .total-count { color: var(--muted); font-size: 0.9rem; margin-bottom: 2rem; } |
| 78 | + |
| 79 | + footer { border-top: 1px solid var(--border); padding: 2rem; text-align: center; color: var(--muted); font-size: 0.85rem; } |
| 80 | + footer a { color: var(--muted); } |
| 81 | + footer a:hover { color: var(--purple-light); } |
| 82 | + </style> |
| 83 | + |
| 84 | + <nav> |
| 85 | + <a href="/" class="nav-logo">Social<span>Proof</span></a> |
| 86 | + <a href="https://app.socialproof.dev/signup" class="nav-cta">Try free</a> |
| 87 | + </nav> |
| 88 | + |
| 89 | + <div class="hero"> |
| 90 | + <a href="/blog" class="back-link">← Back to Blog</a> |
| 91 | + <h1>Blog Archive</h1> |
| 92 | + <p class="sub">Every post we've published on testimonials, social proof, and small business growth.</p> |
| 93 | + </div> |
| 94 | + |
| 95 | + <div class="archive"> |
| 96 | + <p class="total-count">{sorted.length} articles total</p> |
| 97 | + |
| 98 | + {Object.entries(byMonth).map(([month, monthPosts]) => ( |
| 99 | + <div class="month-group"> |
| 100 | + <div class="month-label">{month} — {monthPosts.length} posts</div> |
| 101 | + <ul class="post-list"> |
| 102 | + {monthPosts.map(post => ( |
| 103 | + <li> |
| 104 | + {post.frontmatter.publishedAt && ( |
| 105 | + <span class="post-date"> |
| 106 | + {new Date(post.frontmatter.publishedAt).toLocaleDateString('en-US', { month: 'short', day: 'numeric' })} |
| 107 | + </span> |
| 108 | + )} |
| 109 | + <a href={post.url}>{post.frontmatter.title}</a> |
| 110 | + </li> |
| 111 | + ))} |
| 112 | + </ul> |
| 113 | + </div> |
| 114 | + ))} |
| 115 | + </div> |
| 116 | + |
| 117 | + <footer> |
| 118 | + <a href="/blog">Blog home</a> · |
| 119 | + <a href="/">SocialProof</a> · |
| 120 | + <a href="/for/">Industries</a> |
| 121 | + </footer> |
| 122 | +</Base> |
0 commit comments