Dev.to WebDev 🛠 Dev 👁 0 📖 4 min read

Building a 160-Page Regional-Language Exam Prep Site with Astro 5, Tailwind v4, and Firebase Hosting

Most Indian exam-preparation websites targeting tier-2 and tier-3 towns suffer from the same problem: heavy client-side JavaScript bundles, intrusive ad networks, slow hydration on budget Android phones, and broken regio

Most Indian exam-preparation websites targeting tier-2 and tier-3 towns suffer from the same problem: heavy client-side JavaScript bundles, intrusive ad networks, slow hydration on budget Android phones, and broken regional-language (Devanagari/Marathi) typography.

While building Jijaee — an independent Marathi preparation platform and Android app for Maharashtra Police Bharti aspirants — we wanted the web companion to load almost instantly on 4G mobile data while still supporting 160+ static pages, interactive practice quizzes, a physical-test score calculator, and district-wise cutoff datasets.

Here is the architecture we chose and five real-world engineering bugs we ran into (and fixed) along the way.

1. Why Astro 5 Static SSG + Firebase Hosting?

Our pages fall into three buckets:

  1. Evergreen study hubs & tools: syllabus, 90-day plans, zero-login MCQ practice hubs, and a 50-mark physical test calculator.
  2. Programmatic data pages: 93 district-wise previous-year question paper (PYQ) previews and district cutoff tables.
  3. Editorial Marathi articles: guides, recruitment status updates, and comparative breakdowns.

With Astro 5 (output: "static") + Tailwind CSS v4, the entire 161-page site builds in ~6–9 seconds, ships almost zero client JS by default (only tiny inline scripts for interactive quizzes and calculators), and deploys cleanly to Firebase Hosting with aggressive CDN caching (Cache-Control: public, max-age=31536000, immutable on /_astro/**).

2. The Trailing-Slash Trap Between Astro and Firebase Hosting

One subtle technical SEO bug bit us early:

  • firebase.json had "cleanUrls": true and "trailingSlash": false.
  • Astro's default @astrojs/sitemap integration emitted URLs with trailing slashes (/cutoff/, /ground/).

That created a silent redirect mismatch across all 150+ URLs: Googlebot read /cutoff/ from sitemap-0.xml, requested it, and hit a 301 redirect from Firebase Hosting to /cutoff.

The fix was two lines:

  1. Set trailingSlash: 'never' in astro.config.mjs.
  2. Normalize canonical URLs in a shared helper:
export function canonicalUrl(pathname: string): string {
  const clean = pathname === '/' ? '/' : pathname.replace(/\/+$/, '');
  return new URL(clean, 'https://jijaee.in').href;
}

After rebuilding, every single URL in sitemap-0.xml, <link rel="canonical">, and internal <a> tags matched 200 OK with zero redirect hops.

3. Off-by-One Date Bugs When Building in Non-IST Timezones

Our Marathi blog posts and daily current-affairs pages store dates as YYYY-MM-DD. When we built the static site from a machine in America/New_York (UTC-5), calling new Date('2026-11-17') parsed it as UTC midnight — which shifted backward to November 16 in local time!

Instead of relying on the build host's system timezone, we parsed calendar dates directly and forced Asia/Kolkata (+05:30) for full timestamps:

const MONTHS_MR = [
  'जानेवारी', 'फेब्रुवारी', 'मार्च', 'एप्रिल', 'मे', 'जून',
  'जुलै', 'ऑगस्ट', 'सप्टेंबर', 'ऑक्टोबर', 'नोव्हेंबर', 'डिसेंबर',
];

export function fmtDateMr(input: string): string {
  const m = input.match(/^(\d{4})-(\d{2})-(\d{2})$/);
  if (m) return `${Number(m[3])} ${MONTHS_MR[Number(m[2]) - 1]} ${m[1]}`;
  const d = new Date(input);
  const ist = new Date(d.getTime() + 5.5 * 60 * 60 * 1000);
  return `${ist.getUTCDate()} ${MONTHS_MR[ist.getUTCMonth()]} ${ist.getUTCFullYear()}`;
}

Simple, deterministic, and completely immune to whether CI runs in UTC, EST, or IST.

4. Cleaning 15,600+ Marathi MCQs Without Breaking SSR

Our question bank powers SSR-rendered previews (so users and search engines see real practice questions without logging in). Auditing the rendered HTML surfaced three messy real-world data issues:

  1. Diagram-dependent questions without images: ~31 reasoning questions asked "खालील आकृतीत किती त्रिकोण आहेत?" ("How many triangles are in the figure below?") with no image attached. We added a lightweight filter at build time to exclude image-dependent stems from text-only previews.
  2. Raw Markdown & simple LaTeX inside explanations: Thousands of explanations contained raw **bold** markers, duplicate emojis, or \frac{a}{b} / \sqrt{x} snippets. A pure TypeScript formatter safely escapes HTML first and then converts bold, line breaks, and basic math notation into clean markup with zero runtime JS overhead.
  3. Interactive without a framework: For our 50-mark Physical Ground Score Calculator (1600m/800m run, 100m sprint, and shot put slabs for Male & Female candidates) and inline practice quizzes, plain vanilla <script> islands kept total page JS under 3 KB gzipped.

5. Parsing Official Government PDFs for Structured Cutoff Data

Maharashtra Police recruitment is decentralized — every district police unit publishes its own selection and cutoff PDFs on separate .gov.in portals. Many third-party exam blogs mistakenly mix 50-mark physical ground cutoffs with 100-mark written exam marks or 150-mark final merit totals.

To fix this on our Maharashtra Police Bharti district cutoff hub, we wrote Python scripts using PyMuPDF (fitz) to parse official selection lists and 1:10 ground shortlist PDFs directly from .gov.in portals, separating:

  • Ground cutoff (/50 for Constable, /100 for SRPF)
  • Final selection cutoff (/150)
  • Category & gender breakdowns (OPEN, OBC, SEBC, SC, ST, EWS, NT-A/B/C/D, SBC — Male & Female)

One edge case in official PDF tables: rows where the optional NCC Marks column is blank collapse from 4 numeric tokens (Physical, Written, NCC, Total) to 3 tokens (Physical, Written, Total). Validating total === physical + written + ncc caught that immediately and prevented missing ~35% of candidates during extraction.

Key Takeaways

  • Static-first wins for regional Indian audiences: Shipping ~2–3 KB of JS instead of a 400 KB SPA makes a massive difference on budget mobile devices.
  • Audit your build output, not just your source code: Running quick Python assertions over dist/ after every build caught canonical mismatches, timezone shifts, and broken question stems before they ever hit production.
  • Structured data & instant indexing matter: Pairing clean JSON-LD (FAQPage, Dataset, BlogPosting, BreadcrumbList) with automated IndexNow pings gets new pages discovered within hours instead of weeks.

If you're building a regional-language web app or static content platform with Astro, happy to answer questions in the comments!

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.