The Bash script automates building a static website from Markdown files. Itβs structured to handle:
- converting Markdown to HTML,
- extracting metadata like tags and titles,
- generating tag pages and an index,
- creating an RSS feed, and
- optionally committing changes to a Git repo.
graph TD
A[Start Script] --> B[Set Bash Options and Variables]
B --> C[Create Output and Temp Directories]
C --> D[Check for Pandoc]
D --> E[Define Helper Functions]
E --> F[build_posts Function]
F --> F1[Loop through .md files]
F1 --> F2[Extract title and tags]
F2 --> F3[Write tag mapping to tag_temp/*.txt]
F3 --> F4[Insert tag links into temp markdown]
F4 --> F5[Convert with Pandoc to HTML]
F --> G[build_index Function]
G --> G1[Scan .md files]
G1 --> G2[Sort by date & recency]
G2 --> G3[Generate index content & tag cloud]
G3 --> G4[Write index.html using Pandoc]
G --> H[build_tag_pages Function]
H --> H1[Loop through tag_temp/*.txt]
H1 --> H2[Read associated posts]
H2 --> H3[Generate tag pages via Pandoc]
H --> I[build_rss Function]
I --> I1[Loop through dated .md files]
I1 --> I2[Extract metadata for each item]
I2 --> I3[Write RSS XML items]
I3 --> I4[Output feed.rss]
I --> J[Git Commit and Push]
J --> K[End]
style A fill:#f9f,stroke:#333,stroke-width:1px
style K fill:#bbf,stroke:#333,stroke-width:1px