精选链接横幅

:information_source: Summary Banner Featured Links allows you to create a banner of links.
:eyeglasses: Preview Theme Creator
:hammer_and_wrench: Repository GitHub - Arkshine/discourse-banner-featured-links
:question: Install Guide How to install a theme or theme component
:open_book: New to Discourse Themes? Beginner’s guide to using Discourse Themes

Install this theme component

Summary

Banner Featured Links allows you to create a banner of links.
It provides a wide range of customization options.

It’s a feature inspired by the fantastic “Meta Branded” Discourse theme.

Features

The default look – it uses the theme color.
image

The button can be styled separately:
image

You can place the links at various places via the plugin outlet setting.
A list of common locations is provided in the description.

:information_source: I recommend using the Developer Toolbar theme component to see where the plugin outlets are located!

For example, if you want to mimic the Meta Brand theme, use the search-banner-below-input outlet. It assumes you have installed the Search Banner component.

Details

The current style can be achieved with the following settings:

I encourage you to try your style!

Settings

General

Name Description
links Text links to be displayed in the header.
show_for_members Display the links for logged-in users.
show_for_anon Display the links for anonymous users.
display_on_mobile Display the links on mobile devices.
display_on_desktop Display the links on desktop computers.
display on homepage Displays the links on the homepage.
url must contain Enter paths that should display the banner. Add * to the end of the path as a wildcard.
plugin outlet The location to display the links.
Common Locationsabove-main-containerabove-site-headerafter-headerbefore-header-panelbefore-list-areabefore-topic-listbelow-site-headerheader-list-container-bottomtopic-above-post-stream
Search Banner component:
search-banner-below-headlinesearch-banner-below-input

links setting:

Name Description
Icon The FontAwesome icon or emoji to display for the links.
Shortcuts
Windows: Win + .
Mac: Cmd + Ctrl + Space
ChromeOS: Launch + Shift + Space
Title The title of the link.
URL The URL to link to.
Target Opens the linked document:
_blank: in a new window or tab (this is the default)
_self: in the same frame as it was clicked
_parent: in the parent frame
_top: in the full body of the window.

You can also style per-button. It will overwrite the global style.

Name Description
Width The width of the button.
Font The font of the button.
Rounding The amount of rounding to apply to the button.
Background The background color of the button.
Background Hover` The background color of the button when hovered.
Color` The text color of the button.
Color Hover` The text color of the button when hovered.
Border The border of the button.
Border Hover The border of the button when hovered.
Shadow The shadow of the button.
CSS Classname A custom CSS class to apply to the button.
Useful if you want to style the button differently and the settings are not enough.
You can target with .banner-featured-links__link.your-classname {}

Global Styling

Customize the default spacing and look of the links.
You can overwrite the button styling for each link individually.

Buttons Wrapper Styling

Customize the container of the links.

Name Description
buttons wrapper max width The maximum width of the buttons wrapper.
buttons wrapper margin The margin of the buttons wrapper.
mobile buttons wrapper max width The maximum width of the buttons wrapper on mobile.
mobile buttons wrapper margin The margin of the buttons wrapper on mobile.

Buttons Spacing & Text Font

Customize the spacing of the buttons and the font size of the text.

Name Description
buttons justify How to distribute space between and around links.
buttons gap The gap between the buttons.
buttons font The font of the buttons.
mobile buttons justify How to distribute space between and around links on mobile.
mobile buttons gap The gap between the buttons on mobile.
mobile buttons direction The direction of the buttons on mobile.
mobile buttons font The fpnt of the buttons on mobile.

Button Styling

Customize the default look of the buttons.

Name Description
button width The width of the button.
button padding The padding of the button.
button rounding The amount of rounding to apply to the button.
button background The background color of the button.
button background hover The background color of the button when hovered.
button color The text color of the button.
button colo hover The text color of the button when hover.
button border The border of the button.
button border hover The border of the button when hovered.
button shadow The shadow of the button.

Advanced Customization

You can use the following CSS to customize further:

.banner-featured-links {
  &__wrapper {

  }

  &__wrapper-links {

  }

  &__link {

  }
}

If you provide a customization per button, you can provide a class name in the CSS Classname setting.

Then, you can target this way:

.banner-featured-links {
  &__link.myclass {

  }
}

Useful links

Credits

  • Discourse for the idea, inspired by the amazing Meta Branded theme.
  • Don and nolo – They made an initial version; I took some of their ideas.
19 个赞

关于一个组件的介绍质量很高,但有一个元评论:来自移动设备的屏幕截图。这可以节省在选择有用性、优点和缺点时的时间。

2 个赞

这是受 Meta Branded 主题的启发吗?

我也这么认为 :wink:

3 个赞

我一定是看得太快了——我当时在看“鸣谢”部分 :laughing:

3 个赞

没关系。我已经更新了致谢部分,使其更加清晰。谢谢!

3 个赞

如果您是第一次安装该组件,我已经推送了一个小修复。:+1:
我上次提交重命名了一个设置,但默认值未更新。
感谢 @manuel 报告此问题!

5 个赞

你好 @Arkshine,非常感谢你的这个插件!

我使用它已经有一段时间了,但今天添加另一个按钮后,它破坏了整个论坛,现在看起来是这样的:

你知道这可能是为什么吗?

2 个赞

嘿,那是不是意味着如果移除这个按钮,就不会出错了?

好吧,我不得不联系Discourse团队禁用该插件,所以现在一切都恢复正常了,是的。

我现在有点犹豫是否要恢复旧设置来验证这个理论 :sweat_smile:

2 个赞

我明白了,没关系。抱歉!您是第一个遇到此问题的人。您还记得为按钮输入了什么值吗?如果我能重现它,那将会有所帮助!

2 个赞

好的,非常感谢您的帮助!

这真的很奇怪,因为我最近做了一些更改,而且它运行得很好。

我删除了一个按钮并添加了一个新按钮:

如果日志有帮助的话,这是日志

[{“url”:“https://community.elfsight.com/tags/c/elfsight-changelog/48/new-widget?utm_source=elfsight&utm_medium=elfsight-community&utm_campaign=buttons-under-search&utm_content=new-widget",“icon”:“:fire:”,“text”:“新组件”,“target”:“_self”,“button_color_hover”:“#197bff”},{“url”:“https://community.elfsight.com/tags/c/wishlist/8/In-Progress/l/votes?utm_source=elfsight&utm_medium=elfsight-community&utm_campaign=buttons-under-search&utm_content=in-progress”,“icon”:“”,“text”:“进行中”,“target”:“_self”,“button_color_hover”:“#197bff”},{“url”:“https://community.elfsight.com/c/css-codes/158?utm_source=elfsight&utm_medium=elfsight-community&utm_campaign=buttons-under-search&utm_content=css-codes”,“icon”:“”,“text”:"CSS 代码”,“target”:“_self”,“button_color_hover”:“#197bff”},{“url”:"Ask the Community - Elfsight Community ",“url”:“Elfsight Champion Program: Help us grow our community forum! - Announcements - Elfsight Community”}]

以前:[{“url”=>“Topics tagged new-widget”, “icon”=>“:fire:”, “text”=>“New Widgets”, “target”=>“_self”, “button_color_hover”=>“#197bff”}, {“url”=>“Topics tagged In-Progress”, “icon”=>“”, “text”=>“In Progress”, “target”=>“_self”, “button_color_hover”=>“#197bff”}, {“url”=>“CSS Codes - Elfsight Community”, “icon”=>“”, “text”=>“CSS Codes”, “target”=>“_self”, “button_color_hover”=>“#197bff”}, {“url”=>“Ask the Community - Elfsight Community”, “icon”=>“”, “text”=>“Support”, “target”=>“_self”, “button_color_hover”=>“#197bff”}, {“url”=>“Elfsight Champion Program: Help us grow our community forum! - Announcements - Elfsight Community”, “icon”=>“:trophy:”, “text”=>“Join our Champion Program! “, “target”=>”_self”}]

3 个赞

@Helga_Razinkova 的 PM 帮助下,我得以重现该问题。
我已推送修复 :+1:

简而言之,该组件未预料到通过 设置编辑器 更新设置,并且缺少 icon 字段时会发生错误。

2 个赞

太棒了!它如此全面且可定制;您似乎考虑到了几乎所有事情。

我注意到一个小的 bug,图标有时不可见。

我的链接看起来是这样的:
image

当您执行以下操作时,会发生这种情况:

  1. 使用 Chrome(抱歉,我没有尝试过其他浏览器)
  2. 离开带有 Banner Featured Links 的页面
  3. 使用浏览器的“后退”按钮返回页面

image

您可以在 ehealthforum.nz 上自己演示这一点。

4 个赞

谢谢你,Nathan!我已经提交了一个修复。如果问题仍然存在,请告诉我!

4 个赞

太棒了!!!!全部修复了。

又发现了一个小的(但令人不安的)用户体验 bug:

按钮上的文本仍然被 :visited 伪类捕获,这意味着一旦每个链接被访问过,文本颜色在悬停时会表现异常。

这是未悬停状态:

image

这是访问前悬停状态(图标和文本都会改变)
image

这是访问后悬停状态(请注意,图标改变了,但文本没有)
image

3 个赞

@nathank 你能尝试更新一下看看是否有所改善吗?

2 个赞

这是在使用更新后的实例时出现的。搜索横幅有一个小的 PR,但此 TC 没有要应用的。尽管如此,我还是重新构建了。仍然存在!

它在隐身模式下不显示,我猜是因为它不保存我的访问状态。

4 个赞

此插件是否兼容 AIR 主题,以便在社区页面顶部显示链接到 WordPress 的按钮?