在 Plone 中向 HTML 元素添加命名空间
我希望在 Plone 站点上实现 AddThis。为了让 AddThis 跟踪点击,AddThis 要求需要在 元素上声明
fb
命名空间:
https://www.addthis.com/help/third-party-buttons#facebook-like
唯一我认为要做到这一点的方式就是覆盖main_template
,我不愿意这样做,因为这似乎是一个相当极端的措施。目前,我正在考虑要么将 fb
命名空间放在包含 AddThis 代码的 div 上,然后祈祷,要么尝试推出我自己的缺乏此要求的解决方案。
据我所知,像 collective.addthis 这样的包不会为此烦恼。
I'm looking to implement AddThis on a Plone site. In order for AddThis to track clicks, AddThis requires that the fb
namespace needs to be declared on the <html>
element:
https://www.addthis.com/help/third-party-buttons#facebook-like
The only way that I can think to do this is to override main_template
, which I'm reluctant to do as it seems a rather extreme measure. At the moment I'm considering either putting the fb
namespace on just the div containing the AddThis code, and crossing my fingers, or trying to roll my own solution which lacks this requirement.
As far as I can see, packages like collective.addthis don't bother with this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为什么不使用 JavaScript 在 DOM 中设置它?我假设你通过以下方式得到了一个看起来像你想要的 DOM:
Why not set this in DOM using JavaScript? I am assuming you get a DOM that looks like what you want via:
您尝试过重氮吗?补充plone的html很简单。我已经在我的重氮主题中实现了这一目标,而不必担心过度使用东西
Have you experimented with Diazo yet? Supplementing plone's html is straightforward. I've achieved exactly this in my diazo theme without the worry of overidding stuff