My initial question was actually if you in any way could add a dnd_area inside a blog article but I found out that it is not possible. So after that my question is if it is in any way possible to add additional content modules to a individual blog article? Not just adding it to the post template, but to the individual article? For example a product spot related to the article, a contact card, or any other content module that would be specific to the individual article?
You would need to add your module to the template and add a boolean to show/hide the module.
If the modules are being made specifically for the blog, it’s cleanest to have the boolean inside the module. The just wrap the actual html of the module in that boolean condition.
Also I’d use no_wrapper=True when adding it to the template to avoid any unwanted padding etc. when the module content isn’t being displayed.
If the modules aren’t being specifically made for the blog and you don’t want to add the boolean to the modules themselves, you can just put the boolean in the blog template and wrap the module in an if statement, but it does result in a slightly messier side panel on the blog edit dashboard.
adding flex-columns as @BarryGrennan said are definitly an easy approach currently.
What I’ve came up with was a completly custom blog post module with a repeater module which will give you some sort of drag&drop functionality.
This is a very basic idea of the module. It’s based on a repeater, a choice function, a text and image function. Note that this is just the idea to get started. I’ve created post modules with >15 and with nested loops, multi column layouts…You have almost endless posibilities with this approach.
{{content.post_body }} {# this is required since this informations will be pulled for blog excrepts in cards and such elements outside the blog #}
{% for element in module.elements %}
{% if element.row_type == "text" %}
{{ element.text }}
{% elif element.row_type == "image" %}
<img src="{{ element.image.src }}" alt="{{ element.image.alt}}" class="customBlogImage">
{% elif %}
...
{% endif %}
{% endfor %}
If you want to try this out - I recommed you to :
- work in the Design-Tools since it’s easier to initialy set up and create the logic
- work with the conditional logic inside the top for-loop so you only see the selected option. Otherwise it can be almost not editable for the content creator