In a support thread titled ‘Open New Window/Tab via API,’ olegbc1 seeks to modify their Discourse instance so that clicking the community logo opens a custom URL in a new tab. They’ve added a script using api.changeWidgetSetting to change the logo’s href, but adding target: '_blank' causes an error and reverts the logo to the homepage. jordan.vidrine suggests a workaround from a related thread, sharing a code snippet that uses api.decorateWidget to inject a custom link with target='_blank' into the header. They also direct olegbc1 to a specific reply in the referenced topic, where greg_r confirms the solution works when placed in the </head> section of the theme. The issue appears to stem from changeWidgetSetting not supporting target attributes directly, requiring a widget decoration approach instead. The discussion highlights a common customization challenge in Discourse themes and offers a working alternative for opening external links in new tabs.
Hello, I’ve customized my instace of discourse to take a user to a specific page when they click on the community logo in the top right. It’s just a customized theme, in the header section:
Thanks for the sugestion! I have checked the thread you linked and added a , target:'_blank' to api.changeWidgetSetting. Unfortunately this causes an error and clicking on the top logo takes you back to discourse homepage -