Questo componente del tema è unâevoluzione dei precedenti sforzi relativi ai banner. Lâobiettivo è fornire maggiore facilitĂ e flessibilitĂ attraverso lâuso delle impostazioni del tema.
Di seguito sono riportati alcuni punti salienti delle funzionalitĂ :
Limitare la visualizzazione agli utenti connessi o agli utenti anonimi
Limitare la visualizzazione esclusivamente a dispositivi mobili o desktop
Limitare la visualizzazione a pagine specifiche
Opzioni per la chiusura, lâespansione e la visualizzazione sempre attiva
Opzione per la larghezza completa del browser
Gestione dei colori
Personalizzazione dellâintestazione e delle colonne utilizzando HTML (vedi sotto per ulteriori dettagli)
Opzione per lo stato persistente (vedi sotto per ulteriori dettagli)
Personalizzazione del contenuto del banner
Il contenuto del banner è suddiviso nellâintestazione principale e nelle colonne. Puoi avere fino a 5 colonne nel tuo banner; tuttavia, il numero consigliato è 3 o meno a causa delle limitazioni di larghezza. Sono forniti modelli HTML che possono essere personalizzati per soddisfare le tue esigenze individuali. Puoi anche controllare la larghezza di ogni colonna e aggiungere qualsiasi immagine o icona Font Awesome desideri nella parte superiore di ciascuna colonna.
Utilizzo dellâopzione per lo stato persistente
Lâopzione per lo stato persistente si basa su fino a due cookie. Questi cookie conterranno un nome per il banner e un valore vero/falso relativo allo stato del banner. Se hai preoccupazioni riguardo allâuso dei cookie sul tuo sito, è meglio evitare di utilizzare questa impostazione. Scegliere unâopzione di tempo relativo per lâimpostazione cookie_lifespan garantirĂ che il banner rimanga chiuso/espanso/collassato per quella durata dopo che lâutente ha premuto il pulsante appropriato. Senza questa impostazione, il banner si ripristina ad ogni caricamento completo della pagina. Se apporti una modifica al banner e vuoi assicurarti che tutti gli utenti vedano tali modifiche, anche quelli che avevano precedentemente chiuso il banner, assicurati di modificare il ânome del cookieâ. Ciò ripristinerĂ essenzialmente qualsiasi stato persistente, consentendo poi allâutente di chiudere il banner una volta ancora.
Impostazioni
Nome
Descrizione
show for members
Visualizza il banner per gli utenti connessi al forum
show for anon
Visualizza il banner per gli utenti anonimi
display on mobile
Visualizza il banner sui dispositivi mobili
display on desktop
Visualizza il banner sui computer desktop
display on homepage
Visualizza il banner nella homepage
url must contain
Inserisci i percorsi che devono visualizzare il banner. Aggiungi * alla fine del percorso come carattere jolly
dismissible
Consenti agli utenti di chiudere il banner
collapsible
Consenti agli utenti di espandere e collassare il banner
default collapsed state
Stato di collasso predefinito quando lâimpostazione collapsible è abilitata
cookie lifespan
La durata del cookie utilizzato per ricordare se il banner è stato chiuso, espanso o collassato. Se impostato su ânoneâ, NON verranno utilizzati cookie con questo componente e eventuali cookie precedentemente creati relativi al banner verranno eliminati la prossima volta che un utente esegue un caricamento completo della pagina. I valori sono misurati come singola unitĂ , quindi impostare âyearâ corrisponderĂ a un anno, âweekâ a una settimana, ecc.
cookie name
Quando vengono apportate modifiche importanti al banner, devi modificare il nome del cookie per garantire che tutti i tuoi utenti vedano le modifiche.
full width banner
Visualizza il banner con la larghezza completa del browser
swap default positioning
Se è attivo un altro componente relativo al banner, utilizza questa opzione per scambiare la sua posizione con Versatile Banner
plugin outlet
below-site-header lo posiziona sopra la barra laterale, above-main-container lo posiziona sopra il contenuto a lato della barra laterale
banner background image
LâURL sorgente per lâimmagine di sfondo. Suggerimento: puoi caricare unâimmagine nel tuo tema principale e utilizzare lâURL da essa, ma assicurati di non utilizzare la sezione âUploadsâ di questo componente. Tutti i caricamenti aggiunti a questo componente verranno eliminati ogni volta che viene aggiornato.
banner background image dark
LâURL sorgente per lâimmagine di sfondo quando viene rilevata la modalitĂ scura di sistema.
background color
Utilizzato al posto di unâimmagine di sfondo
background color dark
Utilizzato al posto di unâimmagine di sfondo quando viene rilevata la modalitĂ scura di sistema.
primary text color
Il colore del testo principale del banner
primary text color dark
Il colore del testo principale del banner quando viene rilevata la modalitĂ scura di sistema
secondary text color
Il colore del testo dellâicona e delle intestazioni di testo, e il colore di sfondo del pulsante.
secondary text color dark
Il colore del testo dellâicona e delle intestazioni di testo, e il colore di sfondo del pulsante quando viene rilevata la modalitĂ scura di sistema.
link text color
Il colore del testo dei collegamenti allâinterno del banner
link text color dark
Il colore del testo dei collegamenti allâinterno del banner quando viene rilevata la modalitĂ scura di sistema.
Traduzione
Predefinito
close.title
Chiudi il banner
close.label
Chiudi
toggle.title
Espandi/Collassa il banner
toggle.collapse_label
Collassa
toggle.expand_label
Espandi
Ospitato da noi? I componenti del tema sono disponibili per lâuso nei nostri piani Pro, Business ed Enterprise.
Youâll want to create a new component called âVersatile Banner Customizationsâ and add the above CSS to the Common section. Make sure you add the new component to any active themes that use the Versatile Banner to pick up the customization.
Can you give us an example?
Why will you do that?
I mean⌠all the background image will be a link?
If a user click everywhere on banner will be redirected to that link.
I canât imagine the use.
Hi @tshenry I am using the Versatile Banner theme-component but it disappears when I uncheck âdisplay on desktopâ.
Indeed I would like to display the banner only on mobiles.
But when I uncheck the âdisplay on desktopâ⌠both desktop and mobile Versatile Banner disappear.
Here is the site if you want to check : https://hec.fm
Is it possible to have the links displayed horizontally on mobile as well? I was a bit surprised to see them show up underneath each other in stead of horizontally.
Thanks for reporting this! Sorry for the delayed response. I can reproduce what you describe. Iâm pretty sure I know whatâs going on. Iâll take a look later this week and get back to you.
The height of the banner is primarily dependent on its content, but you can adjust anything as needed with your own CSS. Iâm not sure how well you will be able to fit three columns horizontally on mobile, but you can certainly try with custom CSS as well! Have a look at Make CSS changes on Your Site for some tips.
I think Iâm experiencing a bug on my site with regards to cookie lifespan in maintaining the expanded/collapsed state. What I want is for my site to remember when users collapse the banner and expand the banner, and keep it on whatever they have no matter what. And it works as expected when I stay on the home page or click on topics. However, as soon as I go to the admin panel, user settings, faq, about, tos, privacy, or docs, and then return to the home page, things get wacky, and sometimes the banner is the opposite of what it was set to, and sometimes even the chevron icon to indicate collapse or expand is in the incorrect orientation.
Just discovered that the Versatile Banner isnât appearing on the login page for our forum (itâs a private forum) like it used to.
âDisplay the banner for anonymous usersâ is checked in the component settings
Looking at the html there is a div with class âbanner-boxâ inside a nest of divs with classes âemberXâ but nothing inside the div with class âbanner-boxâ - unlike the html for logged in users.
This should be fixed with the above. Iâm really sorry it took so long to get a fix in place. Thanks again for your report!
You will need to add /login to the url must contain theme setting. See this post for more detail.
This has been reported once or twice in the past. Unfortunately I have never able to reproduce it. Iâll try again when I get a chance using your exact steps and see if I have any luck.
Iâm using versatile banner and i try to turn the banner into a giant link that redirect to another website
how can i do that ?
try to change-it via un script : 'âapi.changeWidgetSetting(âbanner-content-widgetâ, âhrefâ, '<site_adresse>â but the versatille banner stop working
<script type="text/discourse-plugin" version="0.10.0">
// Add the link to the heading
api.reopenWidget("banner-box-widget", {
html(attrs) {
let bannerBox = this._super();
bannerBox[0].children[1].tagName = "A";
bannerBox[0].children[1].properties.href = "https://meta.discourse.org";
return bannerBox;
}
});
// Add the link to the rest of the content
api.reopenWidget("banner-content-widget", {
html(attrs) {
let bannerContent = this._super();
bannerContent.tagName = "A";
bannerContent.properties.href = "https://meta.discourse.org";
return bannerContent;
}
});
</script>
And add a CSS rule to adjust the link color
.banner-box a {
color: var(--primary);
}
Unless thereâs specific functionality you need that the Versatile Banner offers, I wonder if you would be better off just making your own simple HTML banner in a new component. Rough example:
Add the following to the Common âAfter Headerâ section:
<a href="https://meta.discourse.org">
<div class="custom-banner">
<h2>This is a customer banner!</h2>
</div>
</a>
and the following to the Common âCSSâ section:
This is because you are running Discourse version 2.6.0.beta2. The commit you linked to requires 2.6.0.beta3 and above. Youâll notice that the commit you linked to has added a discourse-compatibility file to ensure you donât update to a commit that is incompatible with your Discourse version.
Hi @tshenry
I want to install the component more than once so that I can use each component to give different categories different banners; therefore, I disabled the show on homepage and used the URL must contain, but this stops the main one which I use to display it in the homepage only. Would you either give me a different solution or is this a bug? Thanks! (: