-
Notifications
You must be signed in to change notification settings - Fork 36
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
Support for PartialsDir
or PartialsGlob
#5
Comments
Use include tag:
The path is:
|
@foolin thank you for the answer. I have tried
Above fails with error:
While, use of template works:
|
{{include}} tag is shared the page context arguments, and you don't need passing arguments. So you can just use it. |
Example: GO code:
page.tpl <!-- /views/page.html -->
<!doctype html>
<html>
<head>
<title>{{.Title}}</title>
{{include "layouts/head"}}
</head>
<body>
<a href="/"><- Back home!</a>
{{template "ad" .}}
<hr>
{{include "layouts/footer"}}
</body>
</html> layouts/footer.tpl This page title: {{.Title}} The variable {{.Title}} is shared with {{include}} tag. https://github.com/foolin/goview/tree/master/_examples/advance |
Actually, The more relevant example is The
|
Oh, you wan't the config Partials support for directory or matching specific files, right? |
Yes. I would like to have glob matching support for partials config, like:
|
Golang's native html supports
template.ParseGlob
, which I find quite useful. And for example, another template engine, extemplate, supportsParseDir
.Currently, goview requires all partials to be listed in
goview.Config
. Would it be possible to add support to include partials recursively from specific base directory? Or, include partials matching specific glob?The text was updated successfully, but these errors were encountered: