I'm writing a template for an object that contains files. I'm following the theme building blocks instructions.
<a tal:attributes="href item/id">foo</a>
That makes that the liks downloads the file, as this:
<a href="foo">foo</a>
But I want that link points to the view page of the file, showing its title, description and also, allowing to download it. So I want to get the next output:
<a href="foo/view">foo</a>
How can I generate that attribute?
Use a string:
expression adding the /view
part:
<a tal:attributes="href string:${item/id}/view">foo</a>
Note that you probably want to use the .absolute_url()
(for objects) or the .getURL()
(for catalog results) methods instead to generate full absolute URLs for your items:
<a tal:attributes="href string:${item/absolute_url}/view">foo</a>