@AGENTS.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Gnios Blog is a personal blog built with Next.js and deployed to GitHub Pages. It features MDX-based content for blog posts and snippets, with dark/light theme support and custom styling via Tailwind CSS.
# Development
npm run dev # Start dev server at localhost:3000
# Building and Deployment
npm run build # Build for production (includes `next export`)
npm run deploy # Build + create .nojekyll (ready for GitHub Pages)
# Code Quality
npm run lint # Lint and fix files in pages, components, lib, layouts, scripts
# Resume/CV Tools
npm run resume:generate # Generate both PDF and HTML resume
npm run resume:pdf # Generate PDF resume from data/resume.json
npm run resume:html # Generate HTML resume from data/resume.json
npm run resume:validate # Validate resume JSON schema
npm run resume:serve # Serve resume locally with theme previewThe blog uses a compile-time MDX content system:
-
Content Storage (
/datafolder):- Blog posts:
/data/blog/*.mdx(or.md) - Code snippets:
/data/snippets/*.mdx(or.md) - Activity:
/data/activity/*.mdx - Each file starts with YAML frontmatter (title, date, slug, etc.)
- Blog posts:
-
MDX Compilation (lib/mdx.js):
- MDX files are bundled at build time using
mdx-bundler - Files must exist as
.mdxor.mdformat in/data/{type}/folder - Windows support: Path handling includes
.replace(/\\/g, '/')for Windows paths in content slugs
- MDX files are bundled at build time using
-
Processing Pipeline (Remark/Rehype plugins):
- Remark (markdown → AST):
remarkGfm,remarkMath,remarkCodeTitles,remarkTocHeadings,remarkImgToJsx - Rehype (HTML → AST):
rehypeSlug,rehypeAutolinkHeadings,rehypePrismPlus(syntax highlighting) - Table of contents is extracted during compilation and returned to pages
- Remark (markdown → AST):
-
Key Functions in lib/mdx.js:
getFiles(type)— List all.md/.mdxfiles in/data/{type}/getFileBySlug(type, slug)— Fetch and compile single MDX file (used ingetStaticProps)getAllFilesFrontMatter(folder)— Get frontmatter for all files (skipsdraft: true)
- Dynamic Pages:
/pages/blog/[...slug].js,/pages/snippets/[...slug].js(support nested folders) - List Pages:
/pages/blog.js,/pages/snippets.js,/pages/tags/[tag].js(with pagination) - Static Pages:
/pages/about.js,/pages/projects.js,/pages/resume.js - API Routes:
/pages/api/resume.js(resume data endpoint)
Each content type has a dedicated layout component (layouts/):
PostLayout.js— Blog posts with TOC, reading time, navigationSnippetsLayout.js— Code snippetsListLayout.js— Paginated listsAuthorLayout.js— Author bio pages
- Framework: Tailwind CSS (dark mode:
classstrategy) - Theme Colors: Custom primary color (#DE1D8D, pink/magenta gradient)
- Typography:
@tailwindcss/typographyfor prose styling (blog content) - Animations: Custom keyframes in tailwind.config.js (gradient effects, fade animations)
- Light/Dark: Separate typography CSS variants for both modes
-
Next.js Config (next.config.js):
trailingSlash: true— URLs must have trailing slashes (GitHub Pages requirement)images.unoptimized: true— Next.js image optimization disabled (static export only)- Image domains whitelist includes: Spotify, Twitter, Discord, GitHub, S3, Unsplash, Cloudinary, etc.
- SVG loader:
@svgr/webpackfor inline SVG components
-
Build Output:
out/folder (created bynext export) -
Deployment:
.nojekyllfile created bynpm run deploy(disables Jekyll processing)
Site metadata and navigation are centralized in /data:
- data/siteMetadata.js — Site title, author, analytics, comments provider
- data/nav.js — Main navigation links
- data/projectsData.js — Featured projects
- data/skillsData.js — Skills list
- data/resume.json — JSON Resume format (for resume generation)
- Create file:
data/blog/my-post.mdx - Start with YAML frontmatter:
--- title: "Post Title" date: "2026-04-19" tags: ["tag1", "tag2"] summary: "Short description" ---
- Content is automatically compiled at build time
- Draft posts: add
draft: trueto frontmatter
- Local images:
/public/static/images/(or other public subdirs) - Remote images: Domain must be in
next.config.jsimages.domains - Markdown images are auto-converted to JSX
<Image>components byremarkImgToJsxplugin (Next.js optimization not applied, but component available)
- Markdown code blocks use
rehypePrismPlusfor syntax highlighting - Add language after backticks:
```jsor```python - Line numbers are shown by default (configurable in lib/mdx.js
showLineNumbers: true) - Optional: Add comment above code block:
```js title="filename.js"
- Dev Build:
npm run devuses Next.js dev server with hot reload - Production Build:
npm run buildcompiles MDX, generates static HTML, exports toout/ - GitHub Pages: Automatic CI/CD via GitHub Actions (pushes to
maintrigger deploy) - Build Size: Watch for unused dependencies;
sharp(image processing) is a large peer dep but can be stripped for GitHub Pages
- Windows Compatibility: Path handling for MDX includes Windows backslash conversion (
replace(/\\/g, '/')) - ESBUILD Binary: Automatically set for Windows in lib/mdx.js line 51-55
- Linting: ESLint configured via
next/core-web-vitalspreset; runs onpages/,components/,lib/,layouts/,scripts/ - Code Formatting: Prettier with Tailwind CSS sorting plugin (
prettier-plugin-tailwindcss) - Git Hooks: Husky + lint-staged auto-format staged files before commit