Layout inheritance #112
-
Some static generator templating engines include support for inheriting layouts. Basically, you would have files such as:
But it doesn't seem to work. Is there some way I haven't found just because of different naming or is it just not possible? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
It's definitely possible - nested layouts are built into the Razor engine and work the same way in Statiq as they do in ASPNET. So then the question becomes why they aren't working in your case. You can see an example of nested layouts in the Statiq web site here: https://github.com/statiqdev/statiqdev.github.io/tree/develop/input/news Notice how there's a
That instructs the I wonder if part of the confusion here might be how the Does that make sense? |
Beta Was this translation helpful? Give feedback.
It's definitely possible - nested layouts are built into the Razor engine and work the same way in Statiq as they do in ASPNET. So then the question becomes why they aren't working in your case.
You can see an example of nested layouts in the Statiq web site here: https://github.com/statiqdev/statiqdev.github.io/tree/develop/input/news
Notice how there's a
_ViewStart.cshtml
file that tells every page under the "news" folder to use the/news/_layout.cshtml
layout. In turn, the/news/_layout.cshtml
contains this block at the top:That instructs the
/news/_layout.cshtml
to nest inside the/_layout.cshtml
layout.I wonder if part of the confusion here mi…