How to check if this is the main page on the Plone website using ZPT?

I want to change the title of my website if this is not the main page. Is there a tal: condition expression for this?

I read this and can't find what I'm looking for ...

thanks!

+3
source share
3 answers

The best way is to use two really handy plone views that are only for this purpose. The interface that defines them is at https://svn.plone.org/svn/plone/plone.app.layout/trunk/plone/app/layout/globals/interfaces.py if you want to check it out.

<tal:block
   tal:define="our_url context/@@plone_context_state/canonical_object_url;
               home_url context/@@plone_portal_state/portal_url;"
   tal:condition="python:our_url == home_url">
HERE GOES YOUR STUFF
</tal:block>

@@plone_context_state @@plone_portal_state , . context/@@plone_context_state/canonical_object_url , URL- , : -)

+6

ax:

<tal:block define="global currentUrl request/getURL" condition="python: u'home' not in str(currentUrl)">

<!-- whatever -->

</tal:block>
+1

what about something like <tal:condition="python: request.URLPATH0 == '/index_html'...> `? see TALES Embedded Names and Zope API Reference for a selection.

0
source

Source: https://habr.com/ru/post/1704840/


All Articles