Unique URLs in plone

I have an internal link to sectionA / pageA in the sidebar, when I click it from section B, url becomes section B / sectionA / post. I cannot use an absolute URL because the sidebar is in a static XDV file and I am using linguaplone. How to create a unique url?

+4
source share
1 answer

What do you see by a combination of a relative URL (not starting with / or a full URL, including protocol and hostname) and receiving. The latter means that sectionA can be reached after passing through sectionB . You will need to use absolute URLs in the sidebar.

If you use the template method to create the sidebar (Pagetemplate ZPT, XDV, Diazo, etc.), you will need to ensure that you create an absolute URL, either by requesting page A directly for that absolute URL, or any of his ancestors and then add the url from there. Here are three TAL fragments that accomplish this:

  <!-- query pageA directly --> <a href="sectionA/pageA" tal:attributes="href sectionA/pageA/absolute_url"/> <!-- start at sectionA and add to the URL from there --> <a href="sectionA/pageA" tal:attributes="href string:$(sectionA/absolute_url}/pageA"/> <!-- assuming sectionA is in the site root, use that as the start --> <a href="sectionA/pageA" tal:attributes="href string:$portal_url/sectionA/pageA"/> 

If you use an external template system such as XDV, the same principles apply, but you won’t be able to directly access section or page A for their absolute URLs, but you will have absolute URLs to restore the URLs for available, for example, portal_url in the last example.

+3
source

All Articles