主题页脚按钮

:discourse2: Summary Custom Topic Button defines a button visible at the bottom of your topic to open a URL of your choice.
Custom Group Topic Button defines a button visible at the bottom of your topic to open a URL of your choice, with added group visibility options.
:eyeglasses: Preview Preview on Discourse Theme Creator
(Custom Topic Button)
:hammer_and_wrench: Repository Link(s) https://github.com/discourse/discourse-custom-topic-button-component

https://github.com/discourse/discourse-topic-group-button-component
:open_book: New to Discourse Themes? Beginner’s guide to using Discourse Themes

Install Custom Topic Button

Install Custom Group Topic Button

Features

Hi, let me introduce you to two new simple theme components which have essentially the same goal but are slightly different:

This component will let you define a button visible at the bottom of your topic to open a URL of your choice.

You can customise label/title/icon/link. Links accept multiple placeholders:

<TOPIC_ID>
<USER_ID>
<USERNAME>
<TOPIC_TITLE>
<TOPIC_SLUG>

which will be replaced accordingly.

Has the same behaviour, except you can define a group to limit the visibility of this button.


These components are very simple right now, we could improve them in the future if we see real usage of them and issues.

Settings

Custom Topic Button

Name Description
custom topic button enabled
custom topic button url
custom topic button title Button description here…
custom topic button label Click Me
custom topic button icon

Custom Group Topic Button

Name Description
topic group button enabled
topic group button url
topic group button title Button description here…
topic group button label Click Me
topic group button allowed group
topic group button icon

:discourse2: Hosted by us? Theme components are available to use on our Standard, Business, and Enterprise plans.

Last edited by @JammyDodger 2024-06-15T19:16:42Z

Check documentPerform check on document:
22 个赞

我认为这行不通。我尝试过 api.registerTopicFooterButton,但它不起作用,甚至预览链接也不起作用。
我怀疑是因为脚本标签。使用 javascripts/discourse 的常规方法是有效的。

对我来说是有效的,我尝试了第一个组件,就像它一样:

奇怪。在我的手机和笔记本电脑上,主题创建者的预览链接都将我带到一个没有此类按钮的主题。

1 个赞

哦,你是说主题创建者;它对我也不起作用。不过,在本地安装上,它是可以工作的。

3 个赞