Refactor/internal site - #133
Open
RaphaelPour wants to merge 3 commits into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.