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

Any partial/include template example? #6

Open
vladyslav2 opened this issue Aug 12, 2017 · 5 comments
Open

Any partial/include template example? #6

vladyslav2 opened this issue Aug 12, 2017 · 5 comments

Comments

@vladyslav2
Copy link

Hi Octavore.

Thanks for a great product!

Tell me please, is it possible to do something like this in templates:

 <html>                                                       
   <head>
      {{ template "header" . }}  
      // pr
      {{ partial "header". }} <- like hugo do?
   </head>
...

header.html:

{{define "header"}}                                                              
    <meta>                                                                       
    <link rel="stylesheet" ..>
{{end}}

As far as I can see right now, system gives me an error, any ideas how i can do this?

thanks for reply in advance

@octavore
Copy link
Member

Thanks for the kind words!

Unfortunately that's not currently possible because the templates are rendered directly from the specified template file without loading other templates, but I do think it's worth supporting. I'll try to put something together :)

@vladyslav2
Copy link
Author

Great, thank you.
Let's leave this ticket open and add enhancement label?

@octavore
Copy link
Member

@vladyslav2 this should be fixed now in 0.2.0, you can refer to other template files with e.g. {{ template "path/to/header.html", where path is relative to $THEME_ROOT/templates. let me know!

@vladyslav2
Copy link
Author

@octavore
{{ template "header.html" }} - works

{{ template "partials/header.html" }} - do not works, engine still searching for a template in /templates directory

2017/08/21 13:00:26 [ERROR] error serving page /come-on-come-on [b7ad9a6c-9bf8-41ec-8270-4b0a0b6e16a8]: open data/themes/ketchup-docs/templates/header.html: no such file or directory
2017/08/21 13:00:26 [ERROR] [github.com/ketchuphq/ketchup/server/content/templates/filestore/filestore.go:102] open data/themes/ketchup-docs/templates/header.html: no such file or directory

@octavore
Copy link
Member

good catch, I've just pushed a fix to master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants