How itangqiao/blog-astro-gyoza works
Project Components
• Astro Framework & React: The project uses Astro as the static site generator with React components embedded throughout.
• Frontend (Static + Dynamic): The “src” directory contains most of the application code. This includes components, pages (which are Astro components), layouts, and styles, essentially representing the view layer.
• Content & Configuration: The “src/content” directory holds data like posts, friends, and specification info, while “src/config.json” contains site configurations.
• Plugins: The “src/plugins” directory shows that the project customizes content processing (e.g., code highlighting, embedded media). These transform or enhance Markdown/HTML content.
• Global State Management: The “src/store” directory uses Jotai for managing things such as meta information, theme state, scroll, and viewport data.
• Static Assets & Public Files: The “public” directory hosts fonts, images, and other static files.
• Build & Development Tools: Configuration files like “astro.config.js”, “tailwind.config.ts”, “tsconfig.json”, and package management files indicate tooling for building, testing, and formatting.
Architectural Layers and Their Interactions
• Presentation Layer (Frontend):
• Pages (under “src/pages”) define routes such as blog posts, archives, tags, etc.
• Layouts (“src/layouts”) structure the common look across pages.
• UI Components (“src/components”): Subdivide into headers, footers, heroes, modals, posts, articles, etc., which can be React or Astro components.
• Client-Side Interactive Features: Components like “AnimatedSignature”, “ThemeSwitch”, and “ToastContainer” add dynamic behavior.
• Content Management:
• The “src/content” directory holds Markdown and YAML files that serve as the content for the blog.
• Interaction: Pages and components fetch and render this markdown content.
• Plugins in “src/plugins” transform the raw content (for example, code highlighting with rehype plugins, remark plugins, etc.).
• State & Global Data:
• The “src/store” folder holds state management modules (using Jotai) which enable sharing state across components (e.g., theme, modal stack).
• Styling & Presentation:
• Stylesheets in “src/styles” (including Tailwind CSS and custom global CSS) define the styling.
• Build/Configuration:
• Astro config (“astro.config.js”), along with various tsconfig and prettier settings, provide build and style guidelines.
• Scripts in the “scripts” directory might assist in content generation or other post-build tasks.
• Static File Delivery:
• The “public” folder is served directly, providing static assets to the client.