Migrate templates to Jet v6 with reusable components#79
Draft
Conversation
0d868de to
853a7a9
Compare
Replace Go's html/template with CloudyKit/jet/v6 for server-rendered templates. Jet provides first-class parameterized blocks, template inheritance via extends/yield, and C-like expressions — eliminating the dict helper workarounds that html/template required for reusable components. Add components.html with four reusable Jet blocks: - shell(command, variant, class) — copyable command boxes (replaces ~16 duplicated instances across 6 templates) - notice(variant, class) with yield content — alert boxes with variant-based styling and content slots - input(icon, name, ...) — form inputs with icon and keyboard hint - pagination(pager, class) — pagination controls driven by pre-computed buildPagination() data Key changes: - templates.go: embed.FS loader for Jet, function registration via AddGlobal, buildPagination() helper, render() using VarMap - handlers.go: simplified render calls (no more template combinations) - router.go: *jet.Set replaces *templateSet - All 13 templates converted to Jet syntax (extends/block/yield) - Tailwind scanning unaffected (templates remain .html files) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
853a7a9 to
154cb2f
Compare
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.
Summary
html/templateto Jet v6 (CloudyKit/jet/v6) for first-class parameterized blocks, template inheritance, and C-like expressionscomponents.htmlwith four reusable Jet blocks:shell,notice,input,pagination*jet.Setreplaces pre-parsedtemplateSetwith 11 template combinationsbuildPagination()helper for pre-computing pagination URLs passed to the pagination componentWhy Jet?
html/templatehas no parameterized components — the previous approach requireddicthelper functions andtrustedHTMLworkarounds to pass props to shared template blocks. Jet'sblock/yieldwith named parameters and default values, plusyield contentfor slot-based composition, makes reusable components natural:Components
shellshell(command, variant="default", class="")noticenotice(variant="warning", class="")+yield contentinputinput(icon, name, value, placeholder, type, showShortcut, id, autocomplete)paginationpagination(pager, class="")Test plan
/shortcut works on index and untagged pages🤖 Generated with Claude Code