Skip to content

Commit 1552eb3

Browse files
committed
Refactor Explore and Atlas pages to use client components; implement article fetching and filtering logic
- Moved article fetching logic from ExplorePage to ExploreClient component. - Created AtlasClient component for handling article display and channel filtering. - Updated ChannelsSidebar to support multi-select for channels. - Implemented search functionality in ExploreClient with debouncing. - Added sitemap and robots.txt generation for SEO. - Enhanced performance with content visibility and loading states. - Updated developer documentation for environment setup and content publishing workflow.
1 parent 783ec46 commit 1552eb3

File tree

13 files changed

+639
-724
lines changed

13 files changed

+639
-724
lines changed

CHANGELOG.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
11
# Atlas Frontend Development Changelog
22

3+
## Sept 24, 2025 — SSR Explore/Atlas, SEO, Caching
4+
5+
Enhancements
6+
- Explore and Atlas now server-rendered with incremental static regeneration (`revalidate = 60`). Initial render is fast and SEO-friendly; client hydration handles interactions (search, channels, load more).
7+
- Added per-article `generateMetadata` for Monologue and Dialogue pages (title/description + OpenGraph/Twitter).
8+
- Added `sitemap.xml` and `robots.txt` (reads `NEXT_PUBLIC_SITE_URL`; defaults to `https://example.com`).
9+
- Articles API now returns cache headers: `public, s-maxage=60, stale-while-revalidate=300`.
10+
- Added `.env.example` to document required env vars for local and Vercel.
11+
12+
Developer Notes
13+
- Set `NEXT_PUBLIC_SITE_URL` in Vercel → Project Settings → Environment Variables → all environments, to generate correct absolute URLs in sitemap/robots.
14+
- Explore: moved data loading server-side; client component handles search/debounce only.
15+
- Atlas: moved feed data server-side; client component handles channel filters and load-more.
16+
17+
Files Touched
18+
- `src/app/explore/page.tsx` (SSR page) + `src/app/explore/ExploreClient.tsx` (client UI)
19+
- `src/app/atlas/page.tsx` (SSR page) + `src/app/atlas/AtlasClient.tsx` (client UI)
20+
- `src/app/atlas/monologue/[slug]/page.tsx` and `src/app/atlas/dialogue/[slug]/page.tsx` (generateMetadata)
21+
- `src/app/api/articles/route.ts` (Cache-Control headers)
22+
- `src/app/sitemap.ts`, `src/app/robots.ts`
23+
324
## Current Status: ✅ PRODUCTION READY - Enhanced Channel System with Multi-Select & Conversations
425

526
### 🎉 Latest Updates (Sept 24, 2025):
@@ -246,4 +267,4 @@
246267

247268
**Codebase Health:****READY FOR LAUNCH** - All core features polished, excellent user experience, production-ready
248269

249-
**Theme System:** Tailwind CSS v4 + Geist fonts + auto dark/light mode via `globals.css` and `layout.tsx`
270+
**Theme System:** Tailwind CSS v4 + Geist fonts + auto dark/light mode via `globals.css` and `layout.tsx`

README.md

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,16 @@
11
# Atlas
22

3-
> Where history's greatest minds meet tomorrow's intelligence
3+
The bridge between past wisdom and future intelligence.
44

5-
Atlas is a curated platform for exploring conversations between history's most influential thinkers and the cutting edge of artificial intelligence. Through carefully crafted dialogues and monologues, we bridge centuries of human wisdom with modern computational thinking.
5+
Atlas is a curated reading experience that blends historical insight with modern thinking across three formats:
66

7-
## What Atlas Offers
7+
- Monologues — single‑voice essays inspired by legendary thinkers
8+
- Discussions — simulated dialogues between historical figures
9+
- Editorials — Ruixen commentary, context, and curation
810

9-
**🏛️ Agency** - Meet 27 historical personas, from Nobel laureates to classical philosophers. Each figure comes to life through rich biographical content and authentic voice modeling.
11+
Explore via the Atlas feed, search in Explore (title, author, tags), and browse featured personas in Agency.
1012

11-
**📚 Atlas Feed** - Discover thought-provoking articles in an elegant, reader-focused interface. Each piece explores deep questions through the lens of great minds.
13+
Disclaimer
14+
- The personas, dialogues, and quotes presented here are simulated/creative reconstructions for exploration and learning. They do not represent actual statements by the historical figures. Please verify with original sources where accuracy matters.
1215

13-
**🔍 Explore** - Search and filter through our growing collection of dialogues, monologues, and analytical pieces. Find exactly what sparks your curiosity.
14-
15-
**💭 Dialogues** - Witness conversations that transcend time. Watch Darwin and Turing explore the computational nature of evolution, or see Ostrom and Wiener debate cybernetic governance.
16-
17-
**📝 Monologues** - Experience the world through the eyes of history's greatest thinkers. From Feynman on consciousness to Turing on machine intelligence.
18-
19-
## Featured Thinkers
20-
21-
Our current collection includes minds like Richard Feynman, Marie Curie, Alan Turing, Charles Darwin, Elinor Ostrom, Marcus Aurelius, Hannah Arendt, Leonardo da Vinci, and many others - each contributing their unique perspective to modern questions.
22-
23-
## Philosophy
24-
25-
Atlas believes that the wisdom of the past can illuminate the challenges of tomorrow. By creating authentic conversations between historical figures and contemporary ideas, we explore how timeless insights apply to our rapidly evolving world.
26-
27-
---
28-
29-
*Built with Next.js, TypeScript, and Tailwind CSS. Powered by thoughtful design and respect for intellectual heritage.*
16+
Developer documentation has moved to dev_readme.md.

dev_readme.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Atlas Developer Guide
2+
3+
This document covers environment configuration, deployment notes, and the content publishing workflow. The public README is intentionally user‑focused.
4+
5+
## Environment & URLs
6+
7+
Set this environment variable so `sitemap.xml` and `robots.txt` generate correct absolute URLs:
8+
9+
- `NEXT_PUBLIC_SITE_URL` — your site origin.
10+
- Local dev: `http://localhost:3000`
11+
- Vercel preview: `https://<your-app>.vercel.app`
12+
- Production: `https://your-domain.com`
13+
14+
Local setup:
15+
1. Copy `.env.example` to `.env.local`.
16+
2. Set `NEXT_PUBLIC_SITE_URL` appropriately.
17+
18+
Vercel setup:
19+
- Project Settings → Environment Variables → add `NEXT_PUBLIC_SITE_URL` for Production, Preview, and Development.
20+
21+
## Rendering & Caching Model
22+
23+
- Explore and Atlas are server-rendered with ISR (`revalidate = 60`). The initial HTML is static for SEO and fast TTFB; client hydration powers interactions (search, channels, load more).
24+
- API `/api/articles` returns cache headers: `public, s-maxage=60, stale-while-revalidate=300`.
25+
- Per-article pages (`/atlas/monologue/[slug]`, `/atlas/dialogue/[slug]`) export `generateStaticParams` and `generateMetadata` for full SSG + SEO.
26+
27+
## Publishing Content
28+
29+
This project uses SSG from Markdown:
30+
1. Add `.md` files under `src/content/monologues` or `src/content/dialogues`.
31+
2. Commit and push to trigger a Vercel build.
32+
3. New content appears automatically (sorted by `date` in frontmatter). Explore/Atlas lists are refreshed via ISR.
33+
34+
Frontmatter reference (minimal):
35+
```
36+
title: "My Article Title"
37+
date: "2025-09-24"
38+
type: "monologue" # or "dialogue"
39+
tags: ["topic", "keyword"]
40+
summary: "Optional 1–2 sentences for SEO/social."
41+
author: "Author Name" # For dialogues, use "A & B"
42+
```
43+
44+
## SEO
45+
46+
- `generateMetadata` creates page `title`/`description` and OpenGraph/Twitter tags from frontmatter/summary.
47+
- `src/app/sitemap.ts` and `src/app/robots.ts` use `NEXT_PUBLIC_SITE_URL`.
48+
49+
## Performance Notes
50+
51+
- Images use `next/image` where appropriate (avatars, logo, testimonials). Videos on Agency lazy‑load and autoplay only in viewport, respecting reduced motion.
52+
- Long lists use `content-visibility: auto` to defer off‑screen rendering.
53+
- Explore search input is debounced (200ms).
54+
55+
## File Map (related changes)
56+
57+
- Explore: `src/app/explore/page.tsx` (SSR) + `src/app/explore/ExploreClient.tsx` (client UI)
58+
- Atlas: `src/app/atlas/page.tsx` (SSR) + `src/app/atlas/AtlasClient.tsx` (client UI)
59+
- SEO: `src/app/atlas/monologue/[slug]/page.tsx`, `src/app/atlas/dialogue/[slug]/page.tsx`
60+
- Caching: `src/app/api/articles/route.ts`
61+
- Indexing: `src/app/sitemap.ts`, `src/app/robots.ts`
62+
63+
## Development Tips
64+
65+
- Set `NEXT_PUBLIC_SITE_URL` even locally to sanity‑check sitemap/robots.
66+
- If you later add thumbnails, extend `generateMetadata` to include `openGraph.images`.
67+

src/app/api/articles/route.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,14 @@ export const runtime = 'nodejs'
66
export async function GET() {
77
try {
88
const articles = await getAllArticles()
9-
return NextResponse.json(articles)
9+
return NextResponse.json(articles, {
10+
headers: {
11+
// Cache at the edge for 60s, serve stale for 5 minutes while revalidating
12+
'Cache-Control': 'public, s-maxage=60, stale-while-revalidate=300'
13+
}
14+
})
1015
} catch (error) {
1116
console.error('Failed to fetch articles:', error)
1217
return NextResponse.json({ error: 'Failed to fetch articles' }, { status: 500 })
1318
}
1419
}
15-

0 commit comments

Comments
 (0)