Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 UTC on 18 March 2024, to get $100 off your ticket.
An empty <h1>
is rendered when using the default /node
front page which has no page title.
Comment | File | Size | Author |
---|---|---|---|
#9 | bootstrap-empty-title-rendered-2756865-1.patch | 406 bytes | jwjoshuawalker |
Comments
Comment #2
mstrelan CreditAttribution: mstrelan commentedLooks like title is a render array in Bootstrap where it's just a string in Classy.
Using the
render
filter in twig fixes the issue, but is there a better way to test this?Comment #3
kamalrajsahu21 CreditAttribution: kamalrajsahu21 at Intelliswift commentedCan you send me screenshot or page where an empty h1 tag appears. I checked on front page but there is no empty h1 tag and only one h1 tag with title "Welcome to drupal".
Comment #4
mstrelan CreditAttribution: mstrelan commentedUsing the default frontpage view (configured at admin/structure/views/view/frontpage) which has title set to None.
Comment #5
mstrelan CreditAttribution: mstrelan commentedOnly happens if there is content promoted to the front page.
Comment #6
kamalrajsahu21 CreditAttribution: kamalrajsahu21 at Intelliswift commentedHow title should be empty. If we create a new content then title should be mandatory and in admin/structure/views/view/frontpage at "NO RESULTS BEHAVIOR" block "Global: Title override (Global: Title override)" condition is added. Can you explain in steps how can I regenerate this issue.
Comment #7
mstrelan CreditAttribution: mstrelan commentedI've just run up a clean site to demonstrate this. http://dev-bootstrap-demo.pantheonsite.io/
It looks like this is a core issue and is reproducible in Bartik.
Comment #8
markhalliwellThis is, in fact, a well known and very annoying core bug in 8.x.
Comment #9
jwjoshuawalker CreditAttribution: jwjoshuawalker as a volunteer commentedThis solves the issue for me. (is not empty) - patch attached.
Looking at this page, many methods return false positives:
https://straightupcraft.com/articles/testing-if-something-exists-is-defi...
Comment #10
jwjoshuawalker CreditAttribution: jwjoshuawalker as a volunteer commentedSorry, I just realized I hijacked an issue that was originally different in nature.
My problem & solution is for a different case, when you have a page that has no title, by whatever means you took (A View with empty title, via exclude_node_title.module config, etc), yet an
<h1>
tag is still output.Comment #11
develdru CreditAttribution: develdru as a volunteer and at OpenSense Labs commented@drastik, @mstrelan I tried with both the code.
and
Both seems to work just fine. But is it the empty h1 tag which is bothering us or the CSS property on h1.page-header ?
as it is leaving a blank line on the home page.
@markcarver any suggestions?
Comment #12
markhalliwellThis is a core issue, as I mentioned in #8.
Comment #13
dqd@markcarver: Yeah but it isn't fixed in core yet for complex reasons (as you know) and there is one or more(?) trouble-free work-arounds provided by you and others for contribution we should consider to implement temporary(?), because otherwise hundreds of users have to make their own work-around which can cause even more trouble or issue reports.
BTW: I still can't believe, there is no way of checking if page-title is empty on theme level? o.O ...
To quote Wim on comment #168 of #953034: [meta] Themes improperly check renderable arrays when determining visibility :
Comment #14
markhalliwellNo. I have tried to maintain a policy of not committing hacks and work arounds for known issues in other projects, even if it's from core.
This leads to technical debt and can cause backwards compatibility issues once it is finally fixed upstream.
There are many different things that can be done in a sub-theme until a proper solution can be implemented in core.
Comment #15
dqdOK, my comment edit came too late. I wanted to add a quote of Wim on comment #168 of issue #953034: [meta] Themes improperly check renderable arrays when determining visibility
I think he hoped for contrib area providing temporary fixes. If not, it means we move this complex issue over to the sub themer, who possibly is unable to fix this easily (since its complexity) and this will bring up frustration (no offense) against D8. Just saying that we have a real WTF here.
One annoying example is that we have a real pain in the ass border-bottom under h1 in Bootstrap even if there is no h1. This looks aweful.
Comment #16
WorldFallz CreditAttribution: WorldFallz commentedFor anyone else who stumbles across this issue, I was able to work around it as follows:
{% if title %}
to{% if title['#markup'] is not empty %}
Comment #17
Chi CreditAttribution: Chi commentedPer ticket description #953034: [meta] Themes improperly check renderable arrays when determining visibility is officially marked as "unresolvable". So that even core themes apply ugly workarounds for that issue.
Comment #18
dqdHm ...