|
1 | | -# Open-BeatBox.github.io |
| 1 | +# Beatbox – Content-Driven Next.js Site |
| 2 | + |
| 3 | +A Next.js 15 App Router site for **Beatbox**, an open, modular home-cage cognitive monitoring system. All copy and structure come from Markdown in `content/` and render through reusable React components. |
| 4 | + |
| 5 | +## Content model |
| 6 | +- Site metadata: `content/_site.md` (title, description, keywords, authors, Open Graph/Twitter defaults, logo paths). |
| 7 | +- Pages: top-level Markdown files like `content/home.md`, `content/beatbox.md`. Each has frontmatter with `hero`, `sections`, `layout`, `slug`, and navigation fields. |
| 8 | +- Blog: Markdown in `content/blog/*.md` with `layout: "blog"`, `publishAt` for scheduling, and optional `showInNav`/`navOrder`. |
| 9 | +- Navigation: built automatically from `showInNav` and `navOrder`. |
| 10 | +- Metadata: generated from `_site.md` plus per-page overrides, with canonical URLs built from `NEXT_PUBLIC_SITE_URL`. |
| 11 | + |
| 12 | +## Getting started |
| 13 | +```bash |
| 14 | +npm install |
| 15 | +npm run dev |
| 16 | +``` |
| 17 | + |
| 18 | +## Scripts |
| 19 | +- `npm run dev` – start development server |
| 20 | +- `npm run build` – production build |
| 21 | +- `npm run start` – start production server |
| 22 | +- `npm run lint` – ESLint (Next.js config, ESLint 9) |
| 23 | +- `npm run type-check` – TypeScript `--noEmit` |
| 24 | +- `npm run test` – lightweight utility tests via `ts-node` |
| 25 | + |
| 26 | +## Adding content |
| 27 | +1. Duplicate an existing file in `content/` and adjust frontmatter (`title`, `layout`, `slug`, `hero`, `sections`). |
| 28 | +2. For blog posts, place files in `content/blog/` with `layout: "blog"` and `publishAt`. Future-dated posts are hidden until their date. |
| 29 | +3. Navigation updates automatically from `showInNav` and `navOrder`. |
| 30 | + |
| 31 | +## Metadata & SEO |
| 32 | +- Global defaults come from `content/_site.md`. |
| 33 | +- Per-page metadata uses hero/subtitle or body for descriptions and pulls OG/Twitter images from hero backgrounds, the first Markdown image, or the default logo/OG image. |
| 34 | +- `NEXT_PUBLIC_SITE_URL` is used for canonical, sitemap, and robots entries. |
| 35 | + |
| 36 | +## Environment variables |
| 37 | +Copy `.env.example` to `.env.local` and fill in: |
| 38 | +- `MAILGUN_API_KEY`, `MAILGUN_DOMAIN`, `MAILGUN_API_URL`, `MAILGUN_FROM_EMAIL`, `MAILGUN_TO_EMAIL` |
| 39 | +- `NEXT_PUBLIC_SITE_URL` |
| 40 | +- `NEXT_PUBLIC_RECAPTCHA_SITE_KEY` (optional Google reCAPTCHA for the contact form) |
| 41 | + |
| 42 | +## Contact form |
| 43 | +`/api/send-email` accepts JSON `fields`, sanitizes values, and forwards them to Mailgun. Ensure the Mailgun variables are set and reachable from the server environment. |
| 44 | + |
| 45 | +## Styling |
| 46 | +Tailwind CSS v4 via `@tailwindcss/postcss`, plus small component-scoped CSS files (e.g., `HeroSection.css`, `ContentSections.css`) to keep the glass aesthetic and hero typography. |
| 47 | + |
| 48 | +## Testing |
| 49 | +`npm run test` executes simple utility checks via `ts-node`. Extend with additional utility or content schema tests as needed. |
0 commit comments