How sultandevts/frontend_ssr_news_portal works
Purpose and entry points
This is a Next.js, TypeScript news/content site organized with the App Router. It serves a homepage, article detail pages, and category listing pages, with SEO endpoints and site-wide layout handling.
• app/page.tsx
• app/berita/[slug]/page.tsx
• app/kategori/[slug]/page.tsx
• app/layout.tsx
Route and rendering layer
app/layout.tsx establishes the shared application shell; route-level pages render the major content views. Dynamic [slug] segments represent article and category identifiers. Framework error and missing-page boundaries are explicitly provided.
• app/error.tsx
• app/not-found.tsx
• app/berita/[slug]/page.tsx
• app/kategori/[slug]/page.tsx
Content/API boundary
lib/api.ts is the central boundary for obtaining news, article, or category data. Page routes and server-rendered content components should depend on this layer rather than embedding backend access directly. .env likely supplies deployment-specific API or service configuration.
• lib/api.ts
• lib/constants.ts
• .env
Article presentation pipeline
An article route is composed from focused article components: metadata/header, body content, category identification, related content, and client-side social/engagement actions. This separates server-renderable article structure from browser-interactive controls.
• components/article/ArticleHeader.tsx
• components/article/ArticleContent.tsx
• components/article/RelatedArticles.tsx
• components/article/LikeButton.client.tsx
• components/article/ShareButton.client.tsx
Category and feed experience
Category pages provide category context, filtering, paginated article discovery, and reusable article cards. Filtering is explicitly client-side, while pagination and card rendering form the feed/listing layer shared with content discovery surfaces.
• components/category/CategoryHeader.tsx
• components/category/FilterBar.client.tsx
• components/category/Pagination.tsx
• components/article/ArticleCard.tsx
Engagement and monetization boundaries
Comments are isolated into a section, list, and browser-side submission form, allowing interactive submission without making article rendering wholly client-side. Advertising is similarly isolated behind client components and slot abstractions, supporting placement-specific inventory without coupling ad runtime logic to page content.
• components/comment/CommentSection.tsx
• components/comment/CommentForm.client.tsx
• components/ads/AdSlot.client.tsx
• components/ads/AdArticleMid.client.tsx
• components/ads/AdStickyFooter.client.tsx
Shared UX and SEO infrastructure
Shared navigation, search, and responsive mobile controls live in the layout component family. Search is client-side. SEO is exposed through Next route metadata endpoints for crawler directives and sitemap generation; JSON-LD supports structured-data insertion.
• components/layout/Header.tsx
• components/layout/SearchBar.client.tsx
• components/layout/MobileNav.client.tsx
• app/robots.ts
• app/sitemap.ts
• components/ui/JsonLd.tsx
Main entry points: [slug]/page.tsx Article page [slug] · api.ts Content API · [slug]/page.tsx Category page [slug] · layout.tsx Root layout
Components 19
App Router
Server-rendered pages and framework boundaries.
- Root layout · Establishes the shared application shell.
app/layout.tsx - Homepage
app/page.tsx - Article page [slug]
app/berita/[slug]/page.tsx - Category page [slug]
app/kategori/[slug]/page.tsx - Error & not-found · Framework error and missing-page handling.
app/error.tsx
Content boundary
Shared data access and deployment configuration.
- Content API · Central source for news, article, and category data.
lib/api.ts - API configuration · Deployment-specific service settings.
.env
Article experience
Article rendering and interactive engagement.
- Article structure · Header and body server-rendered article presentation.
components/article/ArticleHeader.tsx - Related articles
components/article/RelatedArticles.tsx - Like & share controls · Browser-interactive social actions.
components/article/LikeButton.client.tsx - Comments · Section and client-side submission form.
components/comment/CommentSection.tsx - Article ad slots · Mid-article and sticky inventory placements.
components/ads/AdArticleMid.client.tsx
Category & discovery
Listing, filtering, and feed components.
- Category header
components/category/CategoryHeader.tsx - Filter & pagination · Client filtering and paginated discovery.
components/category/FilterBar.client.tsx - Article cards · Reusable article listing presentation.
components/article/ArticleCard.tsx
Shared UX & SEO
Site shell, navigation, and crawler endpoints.
- Header & navigation · Includes client search and mobile navigation.
components/layout/Header.tsx - Robots & sitemap · Crawler directives and sitemap generation.
app/robots.ts - JSON-LD · Injects structured metadata.
components/ui/JsonLd.tsx - Sticky footer ad
components/ads/AdStickyFooter.client.tsx
Connections 19
- API configuration → Content API: configures
- Root layout → Header & navigation: renders
- Root layout → Sticky footer ad: places
- Root layout → Error & not-found: wraps routes with
- Homepage → Content API: loads content
- Homepage → Article cards: renders feed
- Article page [slug] → Content API: loads article
- Article page [slug] → Article structure: composes
- Article page [slug] → Related articles: includes
- Article page [slug] → Like & share controls: includes
- Article page [slug] → Comments: includes
- Article page [slug] → Article ad slots: places
- Article page [slug] → JSON-LD: adds metadata
- Category page [slug] → Content API: loads category feed
- Category page [slug] → Category header: renders
- Category page [slug] → Filter & pagination: uses
- Category page [slug] → Article cards: renders
- Filter & pagination → Article cards: filters and pages
- Robots & sitemap → Content API: sources URLs