A component for Conditional UI elements?

Is there a theme component to add buttons, css, or links based on conditions?

I want to add a button were users can request memebership if they don’t have it yet in certain categories.

2 Likes

Hi Joshua, have an answer for that question? I have the same problem

You can look up currentUser throughout most of the application and use its properties to create your condition. Can you share more details about what you’re trying to achieve?

1 Like

Thanks @Johani ! I try to show some elements only in the homepage. I need to verify if this page is the homepage and then show it

Is your element a banner or something similar to that that shows at the top of the homepage?

Can you share a screenshot of what it looks like?

In general i have some elements that i need to show in homepage, like a any web page have a video demo, welcome text, suscribe form, pictures.
Theese content i dont need to show in my other sections (eg categories, threads, etc), because there are in the home page only.
I tryed to make this effect with JS but when i save my code on the “after header” that doesnt run scripts. Only run in “</ body>” and “</ hader>” elements and its impossible to change the order in the html.
For example, if i try to make this structure, its impossible:

  • header
  • search
  • video (only in the home)
  • threads
  • recomendations (only in home)
  • footer

I think that Discourse use a normal webpage in a home path domain and then use the forums in a subdomain, but it would be great to be able to customize content blocks according to the page, and use only Discourse for the entire site.

Sorry about my english :sweat_smile: and thanks for your answer!

1 Like