将类别重定向到外部URL

感谢分享!我正好需要一组子分类,让其中一个充当重定向。由于我的 Customize 已经包含了一个 onPageChange() 检查(用于仅在首页显示标题),这个方案也能适用,而且它并没有硬编码到网站的完整 URL:

<script type="text/discourse-plugin" version="0.8.19">
api.onPageChange((url) => {
       // 检查是否在首页
        if (url === "/" || url === homeRoute) {
              // 对首页执行自定义操作
       } else if ( url=== "/c/redirect-politifora" ) {
             // 分类重定向
             window.location.replace( "https://politifora.com/" );
       } else {
             // 如需,在其他所有页面上执行操作
       }
});
</script>