Forum Discussion

micha80's avatar
micha80
Expert
11 years ago

Make custom component an ActiveCast

Hello,

 

I have created a custom component and want to use this inside our Website. Currently we are using ActiveCasts for integration but I don't find any solution to make a custom component reusable in our Website. Does anyone has experience with this and can tell me the way I have to handle this?

 

If you need further information on this, please feel free to ask.

 

Thanks,

Michael

  • Custom components produce HTML and are designed to be embedded within Lithium pages.

     

    ActiveCast widgets work by injecting JavaScript (hosted on Lithium) into an external page, which in turn injects HTML into the host page.

     

    If you want to create your own ActiveCast widget, the best approach is to create a custom endpoint that outputs JavaScript, then use a <script> tag to inject this into your external page.

     

    Another approach is to create a custom endpoint that returns JSON, and write some JavaScript that calls the endpoint, and consumes the JSON.

    • PaoloT's avatar
      PaoloT
      Lithium Alumni (Retired)

      Indeed, as nathan described in detail, if you have a requirement to reuse components on the Lithium community and on other websites (for example, a support portal landing page that showcases community content), then the recommended approach is to leverage the Studio Endpoints. I would personally use a JSON endpoint that can be then called from either a Lithium standard component, or externally. The data can be packaged up in the format that is most suitable for handling in the client.

       

      It is also possible to call the REST API directly (especially if using Lithium SSO), however if you need multiple calls then the endpoint saves you from making multiple HTTP calls and it is definitely better performance-wise.

       

      Thanks,

      • micha80's avatar
        micha80
        Expert

        Hi nathan,

        hi PaoloT,

         

        I havn't worked with endpoints so far but it sounds like i have to try this out. I will give you feedback on how this is going to work or if I stuck in the middle ;) ...

         

        Thanks a lot,

        Michael

  • Hi micha80 - Can you please elaborate "but I don't find any solution to make a custom component reusable in our Website."

    • Tyson's avatar
      Tyson
      Mentor

      I'm sure one of the esteemed Lithium folks will comment on ActiveCasting custom widgets, which I'm not sure is possible, but could you build your widget on the site you're ActiveCasting to, hitting the API directly to pull back the data you need from Lithium?

       

      Cheers,

      Tyson