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

Switching between rendering with the parent layout or not by adding .HTML to template name #36

Open
floor12 opened this issue Oct 28, 2023 · 2 comments

Comments

@floor12
Copy link

floor12 commented Oct 28, 2023

First of all, thank you for the work you've done; you have a great project.

The only thing that concerns me in your project is the use of .html in the template name. It affects whether the parent layout will be applied or not. In my opinion, this is a terrible decision that goes against the Go language ideology, where simplicity and clarity of the code are paramount. In this case, there is no clear way for a new project contributor to understand how the template name determines whether it will be rendered with the parent layout or not without documentation. I believe that, without breaking backward compatibility, it's possible to keep the option of using .html and add another, more explicit way to specify whether a template will be rendered with a parent layout or not.
Than you.

@foolin
Copy link
Owner

foolin commented Oct 28, 2023

You can config other extension:

 Extension: ".tpl", //file extension

@floor12
Copy link
Author

floor12 commented Oct 28, 2023

I'm talking about something else. It would be clearer to say instead of this, where without reading the documentation, the difference is not understood:

goview.Render(w, http.StatusOK, "index", goview.M{})
goview.Render(w, http.StatusOK, "index.html", goview.M{}) 

Use something like this:

goview.Render(w, http.StatusOK, "index", goview.M{})
goview.RenderPartial(w, http.StatusOK, "index", goview.M{})

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