-
Notifications
You must be signed in to change notification settings - Fork 37
nested layout support? #18
Comments
Yep, you should be able to apply a parent layout. You can see our reference site where we have a post: And it refers to this parent layout: |
Right - that much is working for me. The case I'm trying to solve is where my ie, the markdown content would be rendered within the post layout, which in turn would ideally be rendered within the default layout. edit: gah, formatting |
I haven't tried this myself, but based on the Go code it should be possible. Unfortunately I'm not on my development machine at the moment, so I can't test, but I can help walk you through the code so you can troubleshoot. Here is where we compile our templates: we walk the base directory and use the this layouts = append(layouts, fn) we then process all the templates together: s.templ, err = template.New("layouts").Funcs(funcMap).ParseFiles(layouts...) you should then be able to import templates by file name (you should not include the path)
I'm not sure if you need the suffix or not:
Hopefully that helps. I'll try to run some tests later today when I get a chance |
Ah, I think this is still not quite what I'm after :)
would specify which child layout to include from within the parent layout, as far as I can tell. I'm looking for a way for the child to specify which parent it wants to be rendered in. specifically, i'd like to be able to indicate in both my Jekyll solves this by allowing a parent layout to be specified in the front matter of the child layout, but I don't see any affordance for this kind of relationship in the existing jkl codebase. |
ahh, yes, now I understand. If I remember correctly a Jekyll template can have YAML front-matter and specify a parent template. The template will be rendered inside the parent template's {{ .content }}. when I initially wrote to do something like this we would need to split the So it is definitely possible |
OK, cool. I'll perhaps poke around at this and see if I can come up with anything worth sharing. Thanks for the quick feedback. |
Hi! Thanks for jkl - so far it seems like a nice, simple alternative to Jekyll that retains most of its good qualities.
I'm converting a simple site, and have a layout (post) that, in its front matter, specifies a parent layout (default). I'm not seeing the parent layout get applied, which is a bit of a pain since otherwise I need to duplicate the main page structure in both my post and default layouts.
Have I missed a way to do this with jkl, or is it currently not supported? I'd be willing to dig in and submit a pull request if that would be desirable.
The text was updated successfully, but these errors were encountered: