Classic Plone 6 toolbar not showing on the home page/site root

Some time in the last two weeks, the toolbar menu stopped showing on my Classic Plone 6 site's home page/site root. As far as I can see, it shows everywhere else on the site.

How can we fix this?
What's the best way to determine the cause?

A bit more background
In case it is useful....
I'm not convinced that this caused it but I am aware that we accidentally deleted the page/document content-type under the dexterity-types menu. This was a temporary issue and we restored it by adding back the schema definition (based on the definition from another site).

Probably not related, but there is a permission setting for the toolbar (can show toolbar or something like that ? Maybe you can check in the ZMI)

I can confirm that for deleted content types the <ul class="nav flex-column plone-toolbar-main" ...> subelement of the "toolbar" doesn't show.

This is probably caused by the call view/base_render. See plone/app/layout/viewlets/toolbar.pt:

    <ul class="nav flex-column plone-toolbar-main"
        tal:define="toolbar_main view/base_render"
        tal:condition="toolbar_main">
      <li tal:replace="structure toolbar_main">
      </li>
    </ul>

Usually "Undo" is the best option here. The Site Root is a content type itself, but usually the site root page is a Document.

Take a look at the response whether the element <section id="edit-bar" ...> is present and whether the child element <ul class="nav flex-column plone-toolbar-main" ...> is empty or not?

When the content type is deleted the <ul> element has no children:

grafik

When the content type exists and is correct it has children:

grafik

I can confirm that there is no element with the class nav flex-column on my site root, it shows up everywhere else.

I tried undo unsuccessfully... it may be too far gone. What's the "second best option"?

I just tested deleting a content type locally and the toolbar showed up normal without any issues.

Keep in mind, that the toolbar is a combination of plone.app.layout.viewlets.toolbar.pt showing <browser:menu /> definitions from plone.app.contentmenu ... maybe there's a bit more information, why your toolbar doesn't show up. Specially the plone.app.contentmenu.menu.FactoriesMenu is responsible for gathering the addable content types in the menu.

Did you requested an object of the deleted content type?

No I did not. If I traverse to an "Page" object after deleting the dexterity FTI, there's this traceback:

Traceback (innermost last):
  Module ZPublisher.WSGIPublisher, line 181, in transaction_pubevents
  Module ZPublisher.WSGIPublisher, line 390, in publish_module
  Module ZPublisher.WSGIPublisher, line 285, in publish
  Module ZPublisher.mapply, line 85, in mapply
  Module ZPublisher.WSGIPublisher, line 68, in call_object
  Module Products.CMFDynamicViewFTI.browserdefault, line 79, in __call__
ValueError: No layout found. This may happen b/c nothing was set. Hint: If no FTI was found this happens as well.

When you've selected this page as default_page, you can use <container>/select_default_page or <container>/select_default_view to restore your container view.

To reproduce what happens when deleting a content type (e.g. Document)

Create a Document via RESTAPI:

import requests

url = "http://nohost/plone"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}
auth = ('admin', 'secret')

# install the restapi
requests.post(url + "/@addons/plone.restapi/install", headers=headers, auth=auth)

# create a new Document
response_document = requests.post(
    url,
    json={'@type': 'Document', 'title': 'My Document'},
    headers=headers, auth=auth
)
# get the url of the document
document_at_id = response_document.json()["@id"]

Request the document as 'text/html'

# request the document 
response_document = requests.get(
    document_at_id, headers={'Accept': 'text/html'}, auth=auth
)
pos = response_document.content.decode("utf-8").find(
    '<ul class="nav flex-column plone-toolbar-main">'
)
print(response_document.content.decode("utf-8")[pos:pos + 100]

You get a ul element with children:

<ul class="nav flex-column plone-toolbar-main">
    ...
    <li id="contentview-folderCon ...

Delete the content type Document

# delete content type Document
requests.delete(
    url + "/@controlpanels/dexterity-types/Document",
    headers=headers, auth=auth
)

Request the document as 'text/html'

# request the document 
response_document = requests.get(
    document_at_id, headers={'Accept': 'text/html'}, auth=auth
)
pos = response_document.content.decode("utf-8").find(
    '<ul class="nav flex-column plone-toolbar-main">'
)
print(response_document.content.decode("utf-8")[pos:pos + 100]

You get a ul element without children:

<ul class="nav flex-column plone-toolbar-main">
</ul>
...

And as @petschki reported you get the following error :

2023-02-27 20:44:48,187 ERROR   [Zope.SiteErrorLog:252][waitress-0] 1677527088.18670750.27648887343887274 http://nohost/plone/my-document
Traceback (innermost last):
  Module ZPublisher.WSGIPublisher, line 172, in transaction_pubevents
  Module ZPublisher.WSGIPublisher, line 381, in publish_module
  Module ZPublisher.WSGIPublisher, line 276, in publish
  Module ZPublisher.mapply, line 85, in mapply
  Module ZPublisher.WSGIPublisher, line 68, in call_object
  Module Products.CMFDynamicViewFTI.browserdefault, line 79, in __call__
ValueError: No layout found. This may happen b/c nothing was set. Hint: If no FTI was found this happens as well.

I solved the issue by creating a new page through the web (TTW). I gave it all the same properties of the current home page. Then I made it the default page. In my case I had to rename it to have the same short name as the original page (I have a special diazo rule that relies on the home page being named "front-page"). That was enough to get the toolbar back.

Thank you @mekell.

1 Like

@pigeonflight Just curious: do you have other objects of content type Document in your site that were created before you deleted the Document content type? If yes, do they show the toolbar?

Maybe profile export/import from a clean site or your site backup.

@mekell That's the weird thing. I expected to find the issue with other documents. With Initial inspection, I haven't seen the issue on other parts of the site. I'll do a more thorough review and report back.