How e235221/blog works
Project type and purpose
• This is a JAMstack‐style static blog generator.
• Build step (Node.js) reads Markdown posts, templates, and partials to emit static HTML.
• Deployed to GitHub Pages; at runtime, the browser fetches HTML/CSS/JS and static assets.
File structure
• Top level:
• scripts/ — Node.js build logic
• templates/ & partials/ — HTML skeletons
• posts/ — Markdown source + posts.json manifest
• styles/ & assets/ — CSS and static images
• index.html & article.html — built outputs
• Build script (scripts/build.js) stitches templates+partials+posts.json → index.html & article.html
• Client‐side scripts (main.js & article.js) dynamically pull posts.json or Markdown at runtime
README insights
• Explains build and local‐run workflow
• Describes how new Markdown → posts.json entry → rebuild
• Clarifies runtime behavior: index.html for listing, article.html?post=slug for rendering a single post
Main components
a. Developer environment (local machine)
• Markdown posts & JSON manifest
• Templates & Partials
• Build script (scripts/build.js)
b. CI/CD / Repository
• GitHub repo + .nojekyll
• GitHub Pages host
c. Static Site Artifacts
• index.html, article.html
• CSS (main.css, article.css)
• JS (main.js, article.js, build.js)
• assets/images
d. Client (Browser) at runtime
• HTTP GET static HTML/CSS/JS/assets
• main.js → fetch posts.json → render list
• article.js → read query param → fetch slug.md → convert markdown to HTML
Relationships & interactions
• Developer → invokes build script → reads source (templates, partials, posts) → outputs static files
• Developer → pushes to GitHub → GitHub Pages publishes to CDN
• Browser ← HTTP GET static files from GitHub Pages
• Browser (main.js) ← GET /posts/posts.json
• Browser (article.js) ← GET /posts/{slug}.md
Architectural patterns & principles
• Static site generation (SSG) at build time
• Client‐side rendering of dynamic content (Markdown → HTML)
• Separation of concerns: templates vs. partials vs. content vs. style vs. runtime scripts
Technologies & frameworks
• Node.js (build script)
• Vanilla JavaScript for client behavior (no framework)
• GitHub Pages as static host
• Python’s http.server for local preview
• Transformation steps (Markdown → HTML)
• Query‐parameter mechanism for article.html