I've created a view block that has a contextual filter with a Content ID from URL. The view is only to appear on my content types if the field_aside_content
has any data in it.
This field is just a paragraph reference type to a selected number of custom paragraphs that are to appear in the aside region of my page.
My problem is if I only select a media paragraph type in this content, the block doesn't display on the page. If I then select a paragraph type that is text-based, then the block displays both the media and text content. If I remove the image, the text shows fine on its own.
What I've noticed is that the only time this block doesn't seem to show up on the page is when I select a media-type of paragraph.
My image, video, map and slider paragraph types won't show up on their own unless they're accompanied by some sort of text-based paragraph type or if a menu or some other block is already in the aside that this block shows up in.
It's weird too because if I check the preview of the page when I'm editing the view, it shows the media content showing up, it just doesn't seem to actually show on the published page.
Does anyone have any idea as to what is happening here?
I've also attached a screenshot of my view settings below to show what I've done in case something needs to be tweaked here:
EDIT:
My page.html.twig
file has the following code for the aside:
{% set has_aside = page.sidebar|render|striptags|trim %}
{% if has_aside %}
{% block sidebar %}
<div{{ aside_attributes.addClass(aside_classes).setAttribute('id', aside_id) }}>
{{ page.sidebar }}
</div>
{% endblock %}
{% endif %}
I've noticed that if I remove the |trim
filter, then the images will show up but the issue that then occurs is that even if my aside doesn't have any content in it, it will still show up on a page that doesn't need it.