feat(wiki): wiki templates — reusable content blocks via transclusion #671
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Add a wiki template system allowing reusable content blocks that can be embedded in wiki pages with parameters, similar to Wikipedia's template transclusion (
{{Infobox|key=value}}).Current State
No template or transclusion system exists. Repeated content must be manually duplicated across wiki pages.
Design
Template Pages
_Template/prefix are templates (e.g.,_Template/Infobox.md,_Template/Warning.md)Transclusion Syntax
Parameter Substitution
Inside template files, parameters are referenced as
{{{title}}},{{{message}}}, etc.:Implementation
renderViewPage(), scan the content for{{template:...}}patternsFiles to Modify
routers/web/repo/wiki.gorenderViewPage()services/wiki/wiki_template.gotemplates/repo/wiki/view.tmpl_Template/pages from sidebarWikipedia Parity
Wikipedia has over 60 million template transclusions. Templates are fundamental to maintaining consistent formatting, navigation boxes, infoboxes, and standardized notices across a wiki.