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

implement html including in templates #683

Closed
niansa opened this issue Jan 11, 2021 · 4 comments
Closed

implement html including in templates #683

niansa opened this issue Jan 11, 2021 · 4 comments

Comments

@niansa
Copy link

niansa commented Jan 11, 2021

Is your feature request related to a problem? Please describe.
I want to have a title bar on almost all of my templated pages. but I don't want to copy the code into every single file.

Describe the solution you'd like
A keyword to include a template into another one.

Describe alternatives you've considered
On-the-fly code patching? Idk doesn't sound like it makes sense.

Additional context
No idea. Sorry.

@rbugajewski
Copy link
Collaborator

I think you want to use the <%layout tag in your case. Please refer to Drogon’s view documentation for a more detailed description.

You can also refer to a simple example.

@niansa
Copy link
Author

niansa commented Jan 12, 2021

oh nice. perfect. thx. great work! 👍

@niansa
Copy link
Author

niansa commented Jan 12, 2021

But... how would I as example access the head part of a layout to set title?

@an-tao
Copy link
Member

an-tao commented Jan 12, 2021

But... how would I as example access the head part of a layout to set title?

layout and its subview share the same ViewData object.

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

3 participants