Versatile Banner

You might be able to do something like:

<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:

 .custom-banner {
   display: flex;
   justify-content: center;
   align-items: center;
   width: $large-width; // 1110px
   height: 200px;
   margin-bottom: 15px;
   background: grey;
   color: white;
 }

That would give you a simple banner that’s fully clickable:

3 Likes

hi, does the two column banner previously developed by @Dax here, has any conflict with the current update?

we had changed and customized that banner for our forum, and after the update today, all the changes have vanished! even all the texts has been reverted to " Lorem ipsum dolor sit amet, consectetur adipiscing elit." :frowning:

there used to be a button as “edit theme”, but now it asks to " If you want to edit this theme, you must submit a change on its repository".

is there anyway we can revert the changes? as I don’t want to submit a change, I just to personalize the theme based on our own needs.

p.s.: sorry to post here, the main topic of that theme has been deleted. I also couldn’t find any topic regarding to the change of the admin>customize panel via search.

1 Like

Sorry to hear about your trouble with this :slightly_frowning_face:

It looks like @dodesz pointed you in the right direction in the other topic. I suspect what happened is that you updated the two column banner component and that update wiped out your local changes.

The update should be logged in your staff logs and provide a diff that you can use to extract the customizations you had made. If you did end up restoring a backup, then the log would be gone. If that’s the case, you should follow the suggestions in Restrict editing of remote themes before you update the component again.

3 Likes

thanks for your kind answer :heart:

you mean we can somehow get the previous theme without any need to restore the backup? is there any howto for this or can you explain it a little more? since by looking at the staff logs (in the admin panel of the site), I couldn’t find the changes on that theme.

1 Like