Skip to content

Refactor/internal site - #133

Open
RaphaelPour wants to merge 3 commits into
mainfrom
refactor/internal-site
Open

Refactor/internal site#133
RaphaelPour wants to merge 3 commits into
mainfrom
refactor/internal-site

Conversation

@RaphaelPour

Copy link
Copy Markdown
Owner

No description provided.

RaphaelPour and others added 3 commits June 15, 2026 09:08
The render command was a single ~250-line RunE closure that mixed config
loading, post discovery, markdown rendering, templating, RSS and asset copying,
all wired to package-global flags. This made new features hard to add and left
the logic untestable.

Extract it into a new internal/site package:
- New() loads the config and posts (discovery, metadata filtering, markdown
  rendering, IMAGE() resolution, sorting, prev/next linking).
- Render() runs an ordered list of build stages (renderPosts, renderIndex,
  generateRSS, copyAssets, copyChillFiles). A new output artifact is now a
  Stage appended to the list rather than surgery on a closure.

cmd/render.go becomes a thin CLI wrapper. The embedded default theme moves from
cmd/public to internal/site/public, the content-file helper moves to
internal/common, and templates are parsed once instead of per post. The README
gains an architecture diagram for new contributors.

Output is byte-identical to before this change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The internal/site package wrote progress directly to stdout, which is noise
when the package is embedded as a library. Route progress through an injectable
io.Writer on Options (nil = io.Discard, so silent by default) and let the render
command opt in via a new --verbose/-v flag. Also drop the leftover
"<title> <-> <title>" debug print from the navigation-linking loop.

Output files are unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant