I would like to know if there is a way to pass a dynamic named content to the page from the layout.
For example,
Layout
<body>
<div class="container">
{{ content }}
</div>
<footer>
<p>© Company 2015</p>
</footer>
<script src="path/to/jquery.js"></script>
{{ page.other_content }}<!-- Objective: To write scripts that varies with page -->
</body>
Page
---
layout: default
title: About Us Page
---
<p> This is about us page </p>
{% capture other_content %}
<script>
$(document).ready(function(){
console.log("About us page.");
});
</script>
{% endcapture %}
Is there a way to render multiple content sections in pages from layout?
In ASP.NET we can do this is the Layout page.
@RenderSection("scripts", required: false)
In content page we can render that section like this.
@section scripts {
Hey I'm actually on the _Main layout.
I can vary according to the page.
My presence is not mandatory in every page
}
Can this be done with jekyll?