如何将徽标链接到外部站点? [英] How do I link the logo to an external site?
问题描述
我想更改Plone徽标视图中的链接.默认情况下,它指向Plone站点根目录,我想将其指向不在Plone站点内的位置.
I would like to change the link in the Plone logo viewlet. By default it points to the Plone site root, I want to point it to a location that is not within the Plone site.
我尝试编写自定义徽标视图,但是对于这么小的更改,这似乎非常复杂.最好的方法是什么?
I tried writing a custom logo viewlet, but this seems very complex for such a small change. What is the best way to do this?
推荐答案
更改徽标链接的最简单方法是覆盖徽标视口模板.最好使用 z3c.jbot .
The easiest way to change the Logo link is to override the logo viewlet template. This is best done with z3c.jbot.
您需要将z3c.jbot添加为项目自定义产品,方法是将其作为依赖项添加到setup.py
中,并正确设置configure.zcml:
You need to add z3c.jbot to your projects custom product, by adding it as a dependency in setup.py
, and also set up the configure.zcml correctly:
<include package="z3c.jbot" file="meta.zcml" />
<browser:jbot
directory="templates" />
别忘了确保在<zcml>
标记中添加了浏览器前缀.
Don't forget to make sure you have the browser prefix added in the <zcml>
tag.
您现在可以将logo.pt
文件从plone.app.layout复制到自定义产品的templates
目录中.将文件重命名为plone.app.layout.viewlets.logo.pt
并更改:
You can now copy the logo.pt
file from plone.app.layout to the templates
directory in your custom product. Rename the file to plone.app.layout.viewlets.logo.pt
and change:
tal:attributes="href view/navigation_root_url;
title view/navigation_root_title"
收件人:
href="http://stackoverflow.com"
重新启动服务器,徽标链接现在已更改.
Restart the server, and the logo link has now changed.
这篇关于如何将徽标链接到外部站点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!