多功能横幅

:discourse: 摘要 Versatile Banner 为您的网站添加可自定义的横幅。
:eyeglasses: 预览 在 Discourse 主题创建器中预览
:hammer_and_wrench: 仓库链接 https://github.com/discourse/discourse-versatile-banner
:open_book: 初次接触 Discourse 主题? Discourse 主题使用入门指南

安装此主题组件

功能

该主题组件是以往横幅功能的演进版。其目标是通过主题设置提供更便捷、更灵活的使用体验。

以下是主要功能亮点:

  • 限制仅对登录用户或匿名用户显示
  • 限制仅在移动端或桌面端显示
  • 限制仅在特定页面显示
  • 支持可关闭、可展开及始终可见的选项
  • 全屏浏览器宽度选项
  • 颜色管理
  • 使用 HTML 自定义标题和列(详见下文)
  • 持久状态选项(详见下文)

自定义横幅内容

横幅内容分为主要标题和列。横幅最多可包含 5 列,但由于宽度限制,建议不超过 3 列。系统提供 HTML 模板,您可根据个人需求进行自定义。您还可以控制每列的宽度,并在每列顶部添加任意图片或 Font Awesome 图标。

使用持久状态选项

持久状态选项最多依赖两个 Cookie。这些 Cookie 将包含横幅名称以及表示横幅状态的 true/false 值。如果您担心在网站上使用 Cookie,最好避免使用此设置。为 cookie_lifespan 设置选择相对时间选项,可确保横幅在用户点击相应按钮后,保持关闭/展开/折叠状态达指定时长。若未设置此项,横幅将在每次完整页面加载时重置。如果您修改了横幅并希望确保所有用户(包括之前已关闭横幅的用户)都能看到这些更改,请务必更改「Cookie 名称」。这将实质上重置任何持久状态,然后允许用户再次关闭横幅。

设置

名称 描述
show for members 为登录论坛的用户显示横幅
show for anon 为匿名用户显示横幅
display on mobile 在移动设备上显示横幅
display on desktop 在桌面计算机上显示横幅
display on homepage 在首页显示横幅
url must contain 输入应显示横幅的路径。在路径末尾添加 * 作为通配符
dismissible 允许用户关闭横幅
collapsible 允许用户展开和折叠横幅
default collapsed state 启用 collapsible 设置时的默认折叠状态
cookie lifespan 用于记住横幅是否已关闭、展开或折叠的 Cookie 的有效期。若设置为「none」,则此组件不会使用任何 Cookie,且之前创建的与该横幅相关的 Cookie 将在用户下次执行完整页面加载时删除。数值以单一单位计算,因此设置「year」即为一年,「week」即为一周,以此类推。
cookie name 当对横幅进行重要更改时,必须更改 Cookie 名称,以确保所有用户都能看到这些更改。
full width banner 以完整浏览器宽度显示横幅
swap default positioning 如果还有其他与横幅相关的组件处于活动状态,请使用此选项将其位置与 Versatile Banner 互换
plugin outlet below-site-header 将其置于侧边栏上方,above-main-container 将其置于侧边栏旁内容的上方
banner background image 背景图像的源 URL。提示:您可以将图像上传至您的主主题并使用其 URL,但请确保不要使用此组件的「Uploads」部分。添加到该组件的任何上传内容在更新时都会被删除。
banner background image dark 检测到系统深色模式时背景图像的源 URL。
background color 替代背景图像使用
background color dark 检测到系统深色模式时替代背景图像使用
primary text color 横幅的主要文本颜色
primary text color dark 检测到系统深色模式时横幅的主要文本颜色
secondary text color 图标和文本标题的文本颜色,以及按钮背景颜色。
secondary text color dark 检测到系统深色模式时图标和文本标题的文本颜色,以及按钮背景颜色。
link text color 横幅内链接的文本颜色
link text color dark 检测到系统深色模式时横幅内链接的文本颜色
翻译 默认值
close.title 关闭横幅
close.label 关闭
toggle.title 展开/折叠横幅
toggle.collapse_label 折叠
toggle.expand_label 展开

:discourse2: 由我们托管?主题组件可在我们的专业版、商业版和企业版计划中使用。

101 个赞
Homepage Banner
Homepage specific design and content
Showing two banners: one to anonymous users, and one for logged-in members
Discourse Theme Creation
Activated child Component and broke Discourse!
How to add a simple Banner
Adding a new banner just above the logo
Banner on Discourse
Landing page customization
Message to display to only users without accounts/logged in?
Turned my Discourse into a successful ecommerce platform!
Adding a new banner just above the logo
Ideas for highlighting content on our forum
Impact of component positioning with 2.5.0.beta6
Using an Image for a Global Banner Topic - Dimensions?
Showing a Warning to Non-Registered Users
Customise home login page
Enhancing My engineering Community Landing Page - Technology Support Category
How to add top welcome message to the board
How is the Banner at meta.discourse.org created?
Is it possible to change the order of topics?
Can the new About page be more visible?
Need help to emulate old forum
Creating a banner that only 1 group can see, while the other groups don't
Sticky global notice
Banner text customization for Subscriptions plugin
How to I stop topics automatically un-pinning when a user reaches the bottom?
How to insert Versatile Banner before the content of the post.?
Need guidance for adding description bar
Customizing your site with existing theme components
Homepage Feature
How to Set a Closable Banner at the Top of site?
Order of two items in the same plugin outlet
How to add this type of banner?
Customize Your Site Branding
Can the new About page be more visible?
Asking for advice on "How to create a Banner on the main page"/
No HTML in global notice
Welcome Link Banner theme-component with photos
How to apply CSS code only in the discourse home page?
How to make the automatic dark theme the same as the selected dark theme?
Make the Welcome Banner less intrusive
Your own banner with a link
I want add photo for download my app
How to add title and buttons naturally above forum topics?
Where shall I put this code for a top banner?
Is it possible to insert a box of text between the header and topic list?
How do I create a welcome banner like the one on this site?
Customizing the groups page
What are good plugins or theme components for a forum emphasizing pictures?
Creating a banner to display at the top of your site
Horizon Theme
Missing margin in the .banner- box for Versatile Banner TC
What Are Some Good Welcome Banner Designs?
App interviewer
How minimal is your forum?
How to add a header image and customize it
Category Banners
Как сделать заголовок H1 на главной странице
Как поставить Банер на главной странице
Hover preview and quote of the day
Creating a "Featured Categories" homepage banner
Making my discourse site look a certain way
Help with alignment in the "versatile banner" plugin
Make Banner Undismissable
Can I add a banner only on my homepage?
Welcome message at the top
Globally pinned topic only appears in one category
Pin a post even in the categories home page
How do i turn of unpin/pin option for my forum users?
[PAID] Assistance to Set-up My Forum
Custom HTML on Groups page
Banner diference mobile/web
Help me code menu top same image
Publish a notification at top of the page
How to create a welcome banner/section?
Landing page customization