Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

customize templates #49

Open
cblgh opened this issue Jan 4, 2024 · 1 comment
Open

customize templates #49

cblgh opened this issue Jan 4, 2024 · 1 comment

Comments

@cblgh
Copy link
Owner

cblgh commented Jan 4, 2024

one thing that's been raised recently as the other alex works on cerca are the templates of html/ and how necessarily entwined they become with the structure of the server package's code

perhaps we could explore an alternative where we have a folder /templates which is a directory of other templates, see bottom of post for a quick first sketch. the drawback is all of the duplication, so perhaps instead of duplicating literally every template file for each customized version, a patching approach could be applied: let's say there is a set of base templates (e.g. cerca as it is today) and if a custom template folder is passed (e.g. in config) then each filename that is found in there fully replaces the template of the same name among the base templates.

the thing to keep in mind is that /server's exported structs need to support all the data needed for all templates, even if a template doesn't use it but i think that could be tackled in a pieacemeal fashion. if someone does create a really extensive fork and wants to include too many changes then perhaps that does not need to be mainlined into cerca

> tree templates/

├── fishbb
│   ├── about.html
│   ├── about-template.html
│   ├── assets
│   │   ├── favicon.png
│   │   ├── merveilles.png
│   │   ├── merveilles.svg
│   │   └── theme.css
│   ├── change-password.html
│   ├── change-password-success.html
│   ├── footer.html
│   ├── generic-message.html
│   ├── head.html
│   ├── html.go
│   ├── index.html
│   ├── login-component.html
│   ├── login.html
│   ├── new-thread.html
│   ├── password-reset.html
│   ├── register.html
│   ├── register-success.html
│   └── thread.html
└── original
    ├── about.html
    ├── about-template.html
    ├── assets
    │   ├── favicon.png
    │   ├── merveilles.png
    │   ├── merveilles.svg
    │   └── theme.css
    ├── change-password.html
    ├── change-password-success.html
    ├── footer.html
    ├── generic-message.html
    ├── head.html
    ├── html.go
    ├── index.html
    ├── login-component.html
    ├── login.html
    ├── new-thread.html
    ├── password-reset.html
    ├── register.html
    ├── register-success.html
    └── thread.html

4 directories, 40 files

@alexwennerberg
Copy link
Contributor

perhaps instead of duplicating literally every template file for each customized version, a patching approach could be applied: let's say there is a set of base templates (e.g. cerca as it is today) and if a custom template folder is passed (e.g. in config) then each filename that is found in there fully replaces the template of the same name among the base templates.

I think this makes sense to me -- similar to how the content/ folder is currently used

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

No branches or pull requests

2 participants