Skip to content
Permalink
Browse files

figured out dynamic blog post embed templates...meaning each post emb…

…ed gets its own template type.
  • Loading branch information
justusthane committed Mar 2, 2020
1 parent f97cdeb commit d4b3607705bf5760afa877bc220391db318ae5d5
File renamed without changes.
File renamed without changes.
@@ -12,10 +12,7 @@
<div class="title">{% if child.header.title %}<h2>{{ child.title }}</h2>{% endif %}</div>
<div class="date"><a href="{{child.url}}">{{ child.header.date|date("Y-m-d") }}</a></div>
<div class="content {% if not child.header.title %}blurb{% endif %}">
{{ child.content }}
{% if child.template == 'partials/blurb.html.twig' %}
{% include 'partials/blurb.html.twig' with {blog: page, page: child} %}
{% endif %}
{% include 'partials/' ~ child.template ~ '.html.twig' with {page: child, embed: true} %}
</div>
</section>
{% endfor %}
@@ -0,0 +1,10 @@
{% extends 'partials/base.html.twig' %}
{% block content %}
<div id="content">
<h1>{% if page.parent.url == home_url %}<a href="/">home</a>{% else %}<a href="{{page.parent.url}}">{{page.parent.slug}}</a>{% endif %}/{{header.title}}</h1>
{{ page.content }}
<div id="back">
{% if page.parent.url != home_url %}<a href="{{page.parent.url}}">&lt; more {{page.parent.menu}}</a>{% endif %}
</div>
</div>
{% endblock %}
No changes.
@@ -1,3 +1 @@
This is a blurb

{{ page.content }}
@@ -0,0 +1 @@
{{ page.content }}
@@ -1,15 +1,10 @@
{% extends 'partials/base.html.twig' %}
{% set parent = page.collection({ items: '@self.parent'}) %}

{% block content %}
<div id="content">
<h1>{{page.header.title}}</h1>
<h1>{% if page.parent.url == home_url %}<a href="/">home</a>{% else %}<a href="{{page.parent.url}}">{{page.parent.slug}}</a>{% endif %}/{{header.title}}</h1>
{{ page.content }}
<div id="back">
{% for page in parent %}
{# Link to the parent page unless the parent page is home...TODO find a cleaner way to do this #}
{% if page.url != home_url %}<a href="{{page.url}}">&lt; more {{page.menu}}</a>{% endif %}
{% endfor %}
{% if page.parent.url != home_url %}<a href="{{page.parent.url}}">&lt; more {{page.parent.menu}}</a>{% endif %}
</div>
</div>
{% endblock %}

0 comments on commit d4b3607

Please sign in to comment.
You can’t perform that action at this time.