-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[typhoon] Modular page does not show hero image #466
Comments
The problem is that Blog page is specially built to show a hero + sidebar + list of blog items (https://demo.getgrav.org/typhoon/blog/). You can see this in the To do what you want, will require a bit of manual work. You'll need to start with a copy of the blog page and basically replace the bit that shows the blog posts with modular template bits (the code that loops through all the modular subpages). Here's a real quick example that has NOT been tested:
{% extends 'partials/base.html.twig' %}
{% set blog = theme_var('root_of_blog', null, null, true)|e %}
{% set collection = page.collection() %}
{% set show_sidebar = theme_var('show_sidebar', true)|e %}
{% set show_pagination = theme_var('show_pagination', true)|e %}
{% set show_breadcrumbs = theme_var('show_breadcrumbs', true)|e %}
{% block body %}
<section class="flex-1 bg-gray-100 dark:bg-gray-800">
<div class="">
{{ block('content_surround') }}
</div>
</section>
{% endblock %}
{% block content_wrapper %}
<div class="{{ hero_display ? 'pt-0' : 'pt-16' }}">
{% if show_breadcrumbs and config.plugins.breadcrumbs.enabled %}
{% include 'partials/breadcrumbs.html.twig' %}
{% endif %}
{% embed 'partials/layout.html.twig' %}
{% block items %}
{# This is commented out as it's for displaying the blog posts #}
{#
<div class="flex flex-wrap -mx-4">
{% for post in collection %}
{% include "partials/post-item.html.twig" with {page: post} %}
{% endfor %}
</div>
{% if config.plugins.pagination.enabled %}
<div class="flex justify-center w-full p-6 mx-auto">
{% include 'partials/pagination.html.twig' with {base_url: blog.url, pagination: collection.params.pagination} %}
</div>
{% endif %}
#}
{# Add the modular stuff instead %}
{% for module in page.collection()|filter(module => module.template != 'modular/hero') %}
{{ module.content|raw }}
{% endfor %}
{% endblock %}
{% block sidebar %}
{% include 'partials/sidebar.html.twig' %}
{% endblock %}
{% endembed %}
</div>
{% endblock %} A couple of things to note. This doesnt' use a modular hero, it uses a standard hero section as defined like the
and something like this from the blog page to define the stuff in the hero:
Of course to be able to do this via the admin you will also need to create a
title: Blog
extends@: default
form:
fields:
tabs:
fields:
content:
fields:
content:
unset@: true
header.media_order:
ordering@: 99
header.content.items:
type: textarea
yaml: true
label: Modular Collection
default: 'self@.modular'
validate:
required: true
type: yaml
|
I set up a modular page to be used with a gallery but the formatting on the page looks weird. The hero image won't show as well.
How can I make the modular page show exactly the same as like a Blog page with sidebar and hero image?
The text was updated successfully, but these errors were encountered: