feat: PORTAL_BLOG_SHOW_MAIN_IMAGE#1154
Conversation
Review Summary by QodoAdd PORTAL_BLOG_SHOW_MAIN_IMAGE setting for blog image visibility control
WalkthroughsDescription• Add PORTAL_BLOG_SHOW_MAIN_IMAGE setting to control blog article image visibility • Implement CSS-based conditional hiding of .blog-visual element • Expose setting in template context for conditional class application • Update example configuration with new setting default Diagramflowchart LR
A["settings.py<br/>Add PORTAL_BLOG_SHOW_MAIN_IMAGE"] --> B["Template context<br/>Expose setting"]
B --> C["base.html<br/>Apply no-visual class"]
C --> D["CSS<br/>Hide .blog-visual"]
E["settings_custom.example.py<br/>Document setting"] -.-> A
File Changes1. taccsite_cms/settings/settings.py
|
Code Review by Qodo
1. No-visual keeps media layout
|
| /* To conditionally hide certain content */ | ||
| .app-blog.no-tags .tags, | ||
| .app-blog.no-categories .categories { | ||
| .app-blog.no-categories .categories, | ||
| .app-blog.no-visual .blog-visual { | ||
| display: none; | ||
| } |
There was a problem hiding this comment.
1. No-visual keeps media layout 🐞 Bug ≡ Correctness
Blog list items switch to a special “no media” layout only when the article has no .blog-visual children, but the PR’s CSS hide keeps those children in the DOM. As a result, the no-media layout rule will not apply when no-visual is enabled, likely leaving empty media grid space/misaligned list items.
Agent Prompt
## Issue description
The feed layout uses `:--news-article-item:not(:has(.blog-visual > *))` to detect when a list item has no media and apply `news-feed__article--no-media`. With `no-visual`, `.blog-visual` is hidden but still contains children, so this detection never triggers.
## Issue Context
The PR hides `.blog-visual` via `display:none`, but does not remove the markup. Existing CSS depends on DOM presence to decide layout.
## Fix Focus Areas
- taccsite_cms/static/site_cms/css/src/_imports/components/django.cms.blog.app.css[82-87]
- taccsite_cms/static/site_cms/css/src/_imports/components/django.cms.blog.app.item.css[69-103]
- taccsite_cms/templates/djangocms_blog/includes/blog_item.html[17-28]
## Expected fix
Preferably: stop rendering `.blog-visual` when `PORTAL_BLOG_SHOW_MAIN_IMAGE` is false (template-gated rendering). This will automatically make the `:has(.blog-visual > *)` condition false and enable the correct no-media layout.
If you must keep CSS-only hiding: add an explicit override for no-visual mode to apply the no-media layout mixin (or an equivalent grid/template adjustment) for list items when `.app-blog.no-visual` is present.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Overview
Implements
PORTAL_BLOG_SHOW_MAIN_IMAGEvia CSS class: whenFalse, addsno-visualto.app-blogand hides.blog-visual. Replaces per-portal custom stylesheets for this.Caution
The
display: noneapproach leaves.blog-visualand its<img>in the DOM. Problems::--news-article-item:not(:has(.blog-visual > *))indjango.cms.blog.app.item.cssnever fires, because.blog-visualand its children are still present. This means the "no media" grid layout (which removes the phantommediacolumn and itscolumn-gap) is not applied to list-view articles.Qodo also discovers these issues.
A fix would be to move the conditional into the templates (
post_detail.html,blog_item.html) so the element is not rendered at all.Related
Changes
settings.pysettings_custom.example.pyno-visualclass to.app-bloginbase.htmlwhen setting isFalse.app-blog.no-visual .blog-visual { display: none }indjango.cms.blog.app.cssTesting
PORTAL_BLOG_SHOW_MAIN_IMAGE = Falseinsettings_custom.py..blog-visualis hidden.True; verify.blog-visualis visible.UI
…