{"id":32647773,"url":"https://github.com/papierkorp/golang-thememanager-example","last_synced_at":"2026-06-30T06:31:45.128Z","repository":{"id":320797981,"uuid":"1083383558","full_name":"papierkorp/golang-thememanager-example","owner":"papierkorp","description":"A lightweight Go theme manager with multi-view templates, override system, and hot-swappable themes for web applications","archived":false,"fork":false,"pushed_at":"2025-10-25T22:40:43.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-26T00:21:01.666Z","etag":null,"topics":["chi-router","go","go-templates","golang","golang-web","html-templates","template-engine","theme-manager","theme-switcher","theme-system","thememanager","web-themes"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/papierkorp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-25T22:39:54.000Z","updated_at":"2025-10-25T22:43:04.000Z","dependencies_parsed_at":"2025-10-26T00:21:04.021Z","dependency_job_id":"6a107a64-9134-4c6e-b25c-b4b33a774249","html_url":"https://github.com/papierkorp/golang-thememanager-example","commit_stats":null,"previous_names":["papierkorp/golang-thememanager-example"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/papierkorp/golang-thememanager-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/papierkorp%2Fgolang-thememanager-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/papierkorp%2Fgolang-thememanager-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/papierkorp%2Fgolang-thememanager-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/papierkorp%2Fgolang-thememanager-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/papierkorp","download_url":"https://codeload.github.com/papierkorp/golang-thememanager-example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/papierkorp%2Fgolang-thememanager-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281937747,"owners_count":26586774,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-31T02:00:07.401Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chi-router","go","go-templates","golang","golang-web","html-templates","template-engine","theme-manager","theme-switcher","theme-system","thememanager","web-themes"],"created_at":"2025-10-31T05:57:36.614Z","updated_at":"2025-10-31T05:57:43.233Z","avatar_url":"https://github.com/papierkorp.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Theme Manager\n\nA simple Go-based theme system with template management.\n\n## Features\n\n**Theme System**\n\n- Load multiple themes from `themes/` directory\n- Switch themes via settings page\n- Each theme requires: `theme.json`, `base.gotmpl`, `settings.gotmpl`, `style.css`\n- Theme validation on load (required files, metadata, template structure)\n\n**Views**\n\n- Define multiple views per template in `theme.json`\n- Example: `base.gotmpl` can have \"basic\" and \"advanced\" views\n- Views use Go template `{{define}}` blocks\n- First view in array is rendered as default\n\n**Overwrite System**\n\n- Place templates in `themes/overwrite/` to override current theme\n- Does not require full theme structure\n- Validates overwrite templates before applying\n- Falls back to theme template if overwrite is invalid\n\n**Builtin Theme**\n\n- Embedded into binary at compile time\n- Automatically extracted on startup\n- Set as default theme\n\n**Template Data**\n\n- `{{.Title}}` - page title\n- `{{.Themes}}` - all available themes\n- `{{.CurrentTheme}}` - active theme name\n\n## Usage\n\n```bash\nmake dev   # run development server\nmake prod  # build binaries\n```\n\nServer runs on `http://localhost:1325`\n\n# Theme Creation Guide\n\n## Quick Start\n\nCreate a new folder in `themes/` with the following required files:\n\n```\nthemes/your-theme-name/\n├── theme.json\n├── base.gotmpl\n├── settings.gotmpl\n└── style.css\n```\n\n## Required Files\n\n### 1. theme.json\n\nContains theme metadata and view definitions.\n\n```json\n{\n  \"name\": \"Your Theme Name\",\n  \"version\": \"1.0.0\",\n  \"author\": \"Your Name\",\n  \"description\": \"A brief description\",\n  \"views\": {\n    \"base\": [\"\"],\n    \"settings\": [\"\"]\n  }\n}\n```\n\n**Fields:**\n\n- `name`: Display name of your theme\n- `version`: Theme version (use semantic versioning)\n- `author`: Your name or organization\n- `description`: Brief theme description\n- `views`: Define available views for each template\n\n### 2. base.gotmpl\n\nMain template file. Must exist and contain valid HTML.\n\n**Simple example (no named views):**\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003ctitle\u003e{{.Title}}\u003c/title\u003e\n    \u003clink href=\"/themes/{{.CurrentTheme}}/style.css\" rel=\"stylesheet\" /\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n    \u003ch1\u003e{{.Title}}\u003c/h1\u003e\n    \u003cdiv class=\"nav\"\u003e\n      \u003ca href=\"/base\"\u003eBase\u003c/a\u003e\n      \u003ca href=\"/settings\"\u003eSettings\u003c/a\u003e\n    \u003c/div\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\n**With named views:**\n\n```html\n{{define \"basic\"}}\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003ctitle\u003e{{.Title}}\u003c/title\u003e\n    \u003clink href=\"/themes/{{.CurrentTheme}}/style.css\" rel=\"stylesheet\" /\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n    \u003ch1\u003eBasic View\u003c/h1\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n{{end}} {{define \"advanced\"}}\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003ctitle\u003e{{.Title}}\u003c/title\u003e\n    \u003clink href=\"/themes/{{.CurrentTheme}}/style.css\" rel=\"stylesheet\" /\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n    \u003ch1\u003eAdvanced View\u003c/h1\u003e\n    \u003cp\u003eMore features here\u003c/p\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n{{end}}\n```\n\nIf using named views, update `theme.json`:\n\n```json\n\"views\": {\n  \"base\": [\"basic\", \"advanced\"],\n  \"settings\": [\"\"]\n}\n```\n\n### 3. settings.gotmpl\n\nSettings page template. Must exist and contain valid HTML.\n\n**Example:**\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003ctitle\u003e{{.Title}}\u003c/title\u003e\n    \u003clink href=\"/themes/{{.CurrentTheme}}/style.css\" rel=\"stylesheet\" /\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n    \u003ch1\u003eSettings\u003c/h1\u003e\n\n    \u003cdiv class=\"nav\"\u003e\n      \u003ca href=\"/base\"\u003eBase\u003c/a\u003e\n      \u003ca href=\"/settings\"\u003eSettings\u003c/a\u003e\n    \u003c/div\u003e\n\n    \u003cform method=\"post\" action=\"/settings\"\u003e\n      \u003clabel for=\"theme\"\u003eSelect Theme:\u003c/label\u003e\n      \u003cselect name=\"theme\" id=\"theme\"\u003e\n        {{range .Themes}}\n        \u003coption value=\"{{.Name}}\" {{if eq .Name $.CurrentTheme}}selected{{end}}\u003e\n          {{.Metadata.Name}}\n        \u003c/option\u003e\n        {{end}}\n      \u003c/select\u003e\n      \u003cinput type=\"submit\" value=\"Change Theme\" /\u003e\n    \u003c/form\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\n### 4. style.css\n\nYour theme's CSS file.\n\n**Example:**\n\n```css\nbody {\n  background: #ffffff;\n  color: #000000;\n  font-family: Arial, sans-serif;\n}\n```\n\n## Available Template Data\n\nTemplates receive the following data:\n\n- `{{.Title}}` - Current page title\n- `{{.Themes}}` - List of all themes\n- `{{.CurrentTheme}}` - Name of active theme\n\n## Views System\n\n### Simple Theme (No Named Views)\n\nUse empty string in views array:\n\n```json\n\"views\": {\n  \"base\": [\"\"],\n  \"settings\": [\"\"]\n}\n```\n\nTemplate needs no `{{define}}` blocks.\n\n### Multiple Views\n\nDefine named views in theme.json:\n\n```json\n\"views\": {\n  \"base\": [\"basic\", \"advanced\"],\n  \"settings\": [\"\"]\n}\n```\n\nThen create corresponding `{{define}}` blocks in your template.\n\n## Testing Your Theme\n\n1. Place your theme folder in `themes/`\n2. Run the application: `make dev`\n3. Navigate to `http://localhost:1325/settings`\n4. Select your theme from the dropdown\n5. Test all pages and views\n\n## Validation\n\nThe system validates:\n\n- All required files exist and are not empty\n- theme.json contains all required fields\n- All views defined in theme.json exist as templates\n- Templates parse correctly\n\nIf validation fails, check console output for error messages.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpapierkorp%2Fgolang-thememanager-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpapierkorp%2Fgolang-thememanager-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpapierkorp%2Fgolang-thememanager-example/lists"}