Hello, following this HN thread @josevalim asked me to open a thread regarding template inheritance.
I’d like to offer a basic example that would work in Twig or Django / Jinja2.
The root view, base.html.twig (which would be the layout BUT there is actually no concept of layout) is:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>{% block title %}Default title for any page extending this template{% endblock %}</title>
</head>
<body>
{% block content %}{% endblock %}
</body>
</html>
The view, page1.html.twig, which would be rendered by the action:
{% extends 'base.html.twig' %}
{% block title %}Better title for this page{% endblock %}
{% block content %}
<h1>Phoenix is great</h1>
<div>I've nothing more to say</div>
{% endblock %}
But wait there’s more! What if want another page that uses the same title and adds something to the body? I present to you page2.html.twig:
{% extends 'page1.html.twig' %}
{% block content %}
{{ parent() }}
<div>Oh wait, I also like LiveView ;)</div>
{% endblock %}
So I’m at lost how I would implement that with function components?
Thanks.


















