Refactor to multi-page SPA with React Router and blog system#12
Open
augbog wants to merge 3 commits into
Open
Conversation
- Replace 3D cube homepage with typography-forward hero design featuring animated gradient background, serif headings, and profile/social section - Add blog system powered by markdown files in content/blog/ with a custom Vite plugin for build-time processing - Add React Router for client-side navigation (/, /blog, /blog/:slug, /quotes, /cubes) - Create Nav, Footer, Layout components for shared site chrome - Add blog list page, individual post page with markdown rendering, and post-to-post navigation - Move interactive 3D cube scene to /cubes as easter egg - Add 404.html for GitHub Pages SPA fallback routing - Include 3 sample blog posts to seed the blog - Update styles with dark mode support for all new components https://claude.ai/code/session_01Jtxy4UcYnk9ojrcbVoePvw
The dist/ directory is generated by Vite builds and should not be committed. CI/CD deploys from the build output directly. https://claude.ai/code/session_01Jtxy4UcYnk9ojrcbVoePvw
Virtual modules can't be dynamically imported at runtime. Export a postsMap from the Vite plugin with full content and look up by slug directly in the BlogPost component. https://claude.ai/code/session_01Jtxy4UcYnk9ojrcbVoePvw
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrated the portfolio from a static multi-file structure (separate
index.htmlandquotes.html) to a single-page application (SPA) powered by React Router. Added a blog system with markdown support via a custom Vite plugin, and restructured the codebase to support multiple routes (Home, Blog, Quotes, Cubes).Key Changes
React Router Integration: Converted
App.jsxto useBrowserRouter,Routes, andRoutecomponents. Created aLayoutcomponent that wraps all pages with persistentNavandFooter.New Pages:
Home.jsx— Hero section with animated gradient canvas background, latest blog posts preview, and social iconsBlog.jsx— Blog listing page with all posts sorted by dateBlogPost.jsx— Individual blog post page with markdown rendering and navigation between postsCubes.jsx— Extracted the interactive 3D scene (formerly the homepage) to its own routeMarkdown Blog System:
plugins/vite-plugin-markdown.js— Custom Vite plugin that provides a virtual modulevirtual:blog-postsfor importing blog metadata and contentMarkdownRenderer.jsx— Lightweight markdown-to-JSX renderer (no external dependencies) supporting headings, paragraphs, bold, italic, inline code, code blocks, links, blockquotes, and listscontent/blog/with frontmatter (title, date, tags, excerpt)Navigation & Layout:
Nav.jsx— Fixed navigation bar with active route highlightingFooter.jsx— Site footer with linksLayout.jsx— Wrapper component for consistent page structureGitHub Pages SPA Support:
public/404.html— Redirect script for GitHub Pages SPA routingsrc/main.jsx— Added logic to handle the?p=query parameter from the 404 redirectStyling Updates:
src/styles/index.css— Refined transitions, added component layer utilities, improved line-height defaultsQuotes.jsx— Adjusted min-height to account for fixed navDependencies:
react-router-dom(^7.13.2) for routinggray-matter(^4.0.3) for parsing markdown frontmatterBuild Configuration:
vite.config.js— Removed multi-entry point setup, integrated markdown blog plugindist/files from repository (added to.gitignore)Implementation Details
content/blog/for.mdfiles, parses frontmatter withgray-matter, and exports both a list of posts and a map for slug-based lookupMarkdownRendereruses a simple line-by-line parser to convert markdown to JSX elements, avoiding external markdown librarieshttps://claude.ai/code/session_01Jtxy4UcYnk9ojrcbVoePvw