This feature is meant for templating languages that support inheritance and the idea came from my previous version of site that was generated by Hyde.
Hyde treats content files as templates themselves, which in templating language with block style inheritance can be used to append other data into different parts of the templates. For example:
src/index.html
---
title: Welcome!
extends: base.html
---
{% block css %}
{% parent %}
<link rel="stylesheet" type="text/css" href="/media/index.css"/>
{% endblock %}
{% block content %}
<h1>Welcome!</h1>
{% endblock %}
src/page.html
---
title: Normal page
extends: base.html
---
<h1>A regular page</h1>
templates/base.html
<html>
<head>
<title>{{ title }}</title>
{% block css %}
<link rel="stylesheet" type="text/css" href="/media/common.css"/>
{% endblock %}
</head>
<body>
{% block content %}{% end block %}
</body>
</html>
This method avoids having to write templates or partials that are specific to individual content files, and instead can have the content files drive specific portions of a more generic template. This also keeps content with it's requirement for special treatment together in one place.
For simple cases, like the page.html
above, nothing special has to be done in the content file, as defaults can be specified when setting up the templating engine/plugin.
I wrote a sample implementation in mayo@43a2d0d. It's a bit rough around the corners, especially with having to specify some of the language specific patterns manually, but there is no common way of defining blocks or auto detecting this from the template languages. Maybe potentially a shim library that would define these for common templating libraries, or something akin to consolidate.js for template engines with inheritance.
Any feedback, ideas, or opinions welcome.