# fortune9/blogdown-everyday architecture

> Architecture diagram of the GitHub repository fortune9/blogdown-everyday, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/fortune9/blogdown-everyday
- Repository: https://github.com/fortune9/blogdown-everyday

## Overview

##### Project Type and Purpose
- This is a static website built with the R package **blogdown**, which uses **Hugo** (a Go-based static-site generator) under the hood.
- Content is authored as R Markdown (`.Rmd`) and Markdown (`.md`) files; the build produces raw HTML/CSS/JS assets.
- The site is deployed via **Netlify**, providing CI/CD, CDN, and hosting.

##### Top‐Level Structure and Key Directories
- `content/` – All posts and pages in `.md` or `.Rmd`.
- `layouts/` – Custom Hugo templates (partials, shortcodes, category RSS, etc.).
- `themes/diary/` – Theme folder containing CSS, template overrides, assets.
- `static/` – Static assets copied verbatim to the site root (images, JS libs, trelliscope outputs).
- Config files:
- `config.toml` – Hugo site settings (base URL, menus, parameters).
- `netlify.toml` – Netlify build & deploy settings.
- Project metadata: `.gitignore`, `.gitmodules`, `.Rproj`, README.

##### Main Components
a. **Content Authoring Environment**
- *R/RStudio + blogdown package*
- Sources: `.Rmd` & `.md` in `content/`, theme code in `themes/`, Hugo templates in `layouts/`.
b. **Static‐Site Generator**
- *blogdown* orchestrates Hugo: converts R Markdown to Markdown, then Hugo compiles everything into HTML/CSS/JS.
c. **Asset Store**
- `static/` directory for images, JS, CSS, plus auto‐generated `public/` (implied output).
d. **Version Control**
- Git repository containing source, theme submodule, build scripts.
e. **CI/CD & Hosting**
- Netlify build: triggered by Git push → reads `netlify.toml` & `config.toml` → runs blogdown/Hugo build → publishes to Netlify’s CDN.
f. **End Users**
- Web browsers hit Netlify’s CDN endpoint (HTTPS), retrieve static assets.

##### Component Interactions and Data Flow
- Developer writes/edits `content/*.Rmd` or `*.md` →
- blogdown in R converts Rmd → md, then calls Hugo →
- Hugo processes templates (`layouts/`, theme) + content →
- Generates static files into a `public/` folder (HTML, CSS, JS, images) →
- Git commit & push to remote →
- Netlify CI detects push, reads `netlify.toml` →
- Runs build commands (`blogdown::build_site()` or `hugo`) →
- Deploys build output to Netlify CDN →
- Visitors’ browsers request pages, CDN serves static files.

##### Architectural Patterns and Design Principles
- **Static Site Generation (SSG):** separation of content & presentation; no server‐side logic at runtime.
- **CI/CD Pipeline:** automated build+deploy on Git push.
- **Theme‐based UI:** reusable templates, partials & shortcodes for consistent layout.
- **Modular Content:** granular posts/pages under `content/`, each compiled independently.
- **Asset Pipeline:** Rmd → md → HTML + bundling of static assets.

##### Essential Details to Capture
- The two‐step build (Rmd→md via blogdown, then md→HTML via Hugo).
- Role of `layouts/` & `themes/` in shaping the output.
- Netlify’s automated workflow governed by `netlify.toml`.
- Static asset flow from `static/` into final site.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Content Authoring Environment
    subgraph "Content Authoring Environment"
        AuthorEnv["RStudio + blogdown"]:::process
        Content["content/"]:::store
    end

    %% Template Components
    subgraph "Theme & Layouts"
        Layouts["layouts/"]:::store
        Theme["themes/diary/"]:::store
    end

    %% Configuration Files
    ConfigHugo["config.toml"]:::store
    NetlifyConfig["netlify.toml"]:::store

    %% Asset Store
    Static["static/"]:::store

    %% Build Pipeline
    subgraph "Build Pipeline"
        BlogdownProc["blogdown: Rmd→md"]:::process
        HugoProc["Hugo Engine: md+templates→HTML/CSS/JS"]:::process
    end

    %% Generated Output
    Public["public/ (generated site)"]:::store

    %% Version Control
    Git["Git Repository"]:::service

    %% CI/CD & Hosting
    Netlify["Netlify Build & CDN"]:::service
    CDN["CDN"]:::service

    %% End Users
    Browser["Browser"]:::client

    %% Data Flows
    AuthorEnv -->|authors| Content
    Content -->|feeds| BlogdownProc
    BlogdownProc -->|calls| HugoProc
    Layouts --> HugoProc
    Theme --> HugoProc
    ConfigHugo --> HugoProc
    Static --> Public
    HugoProc --> Public

    Content -->|versioned| Git
    Layouts -->|versioned| Git
    Theme -->|versioned| Git
    Static -->|versioned| Git
    ConfigHugo -->|versioned| Git
    NetlifyConfig -->|versioned| Git

    Git -->|push triggers| Netlify
    Netlify -->|runs build| BlogdownProc
    Netlify -->|deploys output| CDN
    Public -->|served to| CDN
    CDN -->|delivers| Browser

    %% Click Events
    click Content "https://github.com/fortune9/blogdown-everyday/tree/master/content/"
    click Layouts "https://github.com/fortune9/blogdown-everyday/tree/master/layouts/"
    click Theme "https://github.com/fortune9/blogdown-everyday/tree/master/themes/diary/"
    click ConfigHugo "https://github.com/fortune9/blogdown-everyday/blob/master/config.toml"
    click NetlifyConfig "https://github.com/fortune9/blogdown-everyday/blob/master/netlify.toml"
    click Static "https://github.com/fortune9/blogdown-everyday/tree/master/static/"
    click Git "https://github.com/fortune9/blogdown-everyday/blob/master/.gitignore"
    click Git "https://github.com/fortune9/blogdown-everyday/blob/master/.gitmodules"
    click Git "https://github.com/fortune9/blogdown-everyday/blob/master/README.md"
    click Git "https://github.com/fortune9/blogdown-everyday/blob/master/blogdown‐everyday.Rproj"

    %% Styles
    classDef process fill:#add8e6,stroke:#000,stroke-width:1px
    classDef store fill:#90ee90,stroke:#000,stroke-width:1px
    classDef service fill:#ffa500,stroke:#000,stroke-width:1px
    classDef client fill:#d3d3d3,stroke:#000,stroke-width:1px
```
