Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Add "blog" like header image to "default" pages

Started by Muut Archive 11 years ago · 2 replies · 277 views
11 years ago

I'm trying to add the header image feature from the blog list to every "default" pages, but when I add the code, it will not even show the content of the "default.md". It does however show everything but the content generated by default.html.twig. E.g. empty #body DOM.

The theme is Antimatter with this default.html.twig:

TWIG
{% extends 'partials/base.html.twig' %}

{% block content %}
  {% set default_image = page.media.images|first.grayscale().contrast(20).brightness(-100).colo rize(-35,81,122) %}

    {% if default_image %}
    <div class="flush-top blog-header blog-header-image" style="background-image: url({{ default_image.url }});">
    {% else %}
    <div class="blog-header">
    {% endif %}
        {{ page.title }}
    </div>

    {{ page.content }}
{% endblock %}

Anyone who can help me here?

11 years ago

Can you identify the piece of code that makes the page crash after your edits, instead of showing the original content?

11 years ago

Actualy I just got it working. I used {{ page.title }} when it should've been {{ page.header.title }}.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1341 9 years ago
Archive · by Muut Archive, 9 years ago
2 928 9 years ago
Archive · by Muut Archive, 9 years ago
2 4057 9 years ago
Archive · by Muut Archive, 9 years ago
1 2942 9 years ago
Archive · by Muut Archive, 9 years ago
3 1115 9 years ago