My site has a lot of different content types, with a few sharing very similar single page template code. An example…
/content/contentOne
/content/contentTwo
layouts/contentOne
layouts/contentTwo
- single.html
The code in each of these single.html templates is nearly identical, but with some difference. Is there a way to set the single.html
template from contentTwo
to inherit the single template from contentOne
?
Not a direct inheritance, no, but if you find they share a lot of code, I’d recommend breaking up as much as possible into partials…or a single partial where you pass in a different context based on section. Mind sharing a repo or more of your templating?
We use partials quite a bit and already pass in dictionaries including .
as a member. But a main partial for similar content is a good idea. I don’t have a public repo to share yet but I appreciate the help
Thank you!
No problem. Just be sure to @ me when you have some code to share and I’d be happy to help. Cheers!