Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I agree it is much nicer to have a layout template which includes your view templates (ala rails and many other systems), rather than including header/footer in each template. Yes you can do this, I handle this by having a layout template which includes a key for content, and rendering each view into its own template (without header/footer) which then goes into the content key of the layout. This is pretty straightforward to do though apparently not a usage they anticipated.

They've recently introduced the concept of blocks too which is an attempt to solve this though it looked pretty clunky to me last time I looked. See this discussion from author of hugo asking how to use it (always a bad sign!):

https://github.com/golang/go/issues/14285

I think I prefer just rendering the view separately and then rendering it into the layout, it's easy to do.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: