Hi everyone, I’m getting started on developing things for Discourse, and I’m working on a theme component. 
Link: GitHub - NateDhaliwal/discourse-persistent-banner: A theme component for Discourse that cannot be closed by the user. 
When putting it on Theme Creator, the settings don’t appear, even though I have a settings.yml. Any ideas?
             
            
               
               
              1 Like 
            
            
           
          
            
              
                Moin  
                
               
              
                  
                    September 20, 2024,  8:28am
                   
                   
              2 
               
             
            
              Do you see any error messages at theme creator?
I think you have to use the same quotation marks at the beginning and end.
This could also be a problem. I would try default: ""
Maybe you want to add “block” to the choices. Otherwise you have to use the revert button to choose that again.
             
            
               
               
              2 Likes 
            
            
           
          
            
            
              Whoops, just realised I was clicking on ‘Create new’ instead of importing it… 
But now, when I try using the URL, it says that about.json is invalid or doesn’t exist, asking me if it is a theme. 
About.json:
  
  
    
      {
  "name": "Persistent banner",
  "about_url": "",
  "license_url": "https://github.com/NateDhaliwal/discourse-persistent-banner/blob/main/LICENSE"
  "component": true,
  "version": 1.0.0,
  "authors": "NateDhaliwal"
}
 
   
  
    
    
  
  
 
Is there something wrong?
             
            
               
               
               
            
            
           
          
            
              
                merefield  
                (Robert)
               
              
                  
                    September 20, 2024, 10:48am
                   
                   
              4 
               
             
            
              Missing comma after license URL.
             
            
               
               
              4 Likes 
            
            
           
          
            
            
               
@merefield   Would version be in ""?
             
            
               
               
              1 Like 
            
            
           
          
            
              
                merefield  
                (Robert)
               
              
                  
                    September 20, 2024, 10:58am
                   
                   
              6 
               
             
            
              Probably that too.  Just look at examples.
             
            
               
               
              1 Like 
            
            
           
          
            
            
              Thanks! One last one, I can’t seem to get the variable to display.
Was it because I didn’t initialise it properly? I tried following the guide…
             
            
               
               
               
            
            
           
          
            
            
              Would I have to use
import Component from "@glimmer/component";
export default class PracticeComponent extends Component {
  get bannerLinks() {
    return JSON.parse(settings.banner_links);
  }
}
 
then?
             
            
               
               
              1 Like 
            
            
           
          
            
              
                merefield  
                (Robert)
               
              
                  
                    September 20, 2024, 11:13am
                   
                   
              10 
               
             
            
              Look at the billions of examples 
             
            
               
               
              1 Like 
            
            
           
          
            
              
                merefield  
                (Robert)
               
              
                  
                    September 20, 2024, 11:22am
                   
                   
              11 
               
             
            
              You only need to use a gjs file if you need to process stuff with javascript, otherwise an hbs template file might suffice.  Experiment.
             
            
               
               
              1 Like 
            
            
           
          
            
            
              I’m not sure if I’m going in the right direction. 
I made javascripts/persistent-banner.hbs with this:
But nothing shows up. Tried putting it in different places, still won’t work.
Tried looking at example, but many don’t seem to help. 
Any advice?
             
            
               
               
              1 Like 
            
            
           
          
            
              
                Moin  
                
               
                 
              
                  
                    September 21, 2024, 11:51am
                   
                   
              13 
               
             
            
              In which plugin outlet do you want to put your banner? 
Take a look at Using Plugin Outlet Connectors from a Theme or Plugin 
You could use Add a featured topic list to your Discourse homepage  as an example
You can use the Plugin outlet locations theme component  to find the names and locations of the plugin outlets. “above-main-container” for example is the top one above the topic list, but not above the sidebar. 
Looking at the code of a Theme component   which adds something similar is also a great way to learn.
             
            
               
               
              2 Likes 
            
            
           
          
            
              
                merefield  
                (Robert)
               
              
                  
                    September 21, 2024, 11:57am
                   
                   
              14 
               
             
            
              You do not need and should not put script tags in hbs files.  They should be limited to the content of the template.
Don’t stab in the dark, read the guides:
  
  
     
  There's a new component API in Octane! For this section, we'll be focusing on the differences between the new style, known as Glimmer components, and classic components, and how to upgrade. "Classic" components refer to older-style components that do...
   
  
    
    
  
  
 
             
            
               
               
              3 Likes 
            
            
           
          
            
            
              So… I managed to get it working without using a hbs file, but instead using the <script> tag with handlebars, and it now works. 
I use it like this for now, but I’ll continue to try using a hbs file instead.
             
            
               
               
              1 Like 
            
            
           
          
            
              
                Lilly  
                (Lillian Louis)
               
              
                  
                    September 22, 2024,  3:24am
                   
                   
              16 
               
             
            
              created a quick pull request for you so you can see the way to split up the files properly. feel free to merge or just have a look at the branch .
  
  
    
    
  
      
    
      NateDhaliwal:main ← Lillinator:split-into-handlebars-files
    
      
        
          opened 03:22AM - 22 Sep 24 UTC 
        
        
        
       
   
 
  
    split into the handlebars files for you :)
also removed the header.html file
   
   
  
    
    
  
  
 
             
            
               
               
              6 Likes 
            
            
           
          
            
            
              Thanks so much! It works now!
             
            
               
               
              1 Like 
            
            
           
          
            
              
                Lilly  
                (Lillian Louis)
               
              
                  
                    September 22, 2024,  3:15pm
                   
                   
              18 
               
             
            
              No worries Nate. Keep up the experimenting, reading and looking at other examples.  In no time you’ll be much better than I am at this dev stuff   
             
            
               
               
              2 Likes 
            
            
           
          
            
            
              Thanks for the encouragement!
             
            
               
               
              1 Like 
            
            
           
          
            
              
                system  
                (system)
                  Closed 
               
              
                  
                    October 22, 2024, 10:58pm
                   
                   
              20 
               
             
            
              This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.