你好,我已经自定义了我的 Discourse 实例,让用户点击顶部的社区标志时跳转到特定页面。这只是一个自定义主题,位于头部区域:
<script type="text/discourse-plugin" version="0.4">
api.changeWidgetSetting('home-logo', 'href', 'https://custom-url-here')
</script>
有什么方法可以让该链接在新浏览器标签页中打开吗?
你好,我已经自定义了我的 Discourse 实例,让用户点击顶部的社区标志时跳转到特定页面。这只是一个自定义主题,位于头部区域:
<script type="text/discourse-plugin" version="0.4">
api.changeWidgetSetting('home-logo', 'href', 'https://custom-url-here')
</script>
有什么方法可以让该链接在新浏览器标签页中打开吗?
这可能会有所帮助。
感谢你的建议!我查看了你所链接的帖子,并在 api.changeWidgetSetting 中添加了 , target:'_blank'。但不幸的是,这导致了错误,点击顶部徽标会带你回到 Discourse 主页——
以下代码摘自之前某个主题中被标记为解决方案的回复。
<script type="text/discourse-plugin" version="0.4">
api.decorateWidget('header-buttons:after', helper => {
const showExtraInfo = helper.attrs.minimized;
if (!showExtraInfo) {
return helper.h('a.blog-link', {href:'https://blog.example.com', target:'_blank'}, '访问我们的博客'); }
});
</script>
你访问过这个主题回复吗?
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.