I have a requirement to play audio files on my website. I need to use a custom player (called by JavaScript) in order to make that happen. I don't see any way to create a component that allows me to push out custom javascript.

Is there a pre-built component that allows me to insert a custom javascript/player? If not, what is the recommended way to create this in code?


You could use Plain HTML rendering for that.

Example datasource content:

enter image description here

Result: enter image description here


This is the easiest way to inject small js parts (I would not call this elegant way). However if you want make true rendering you should consider creating it from the beginning.

Good start is to take a look how Facebook Comments and Disqus renderings were implemented.

There are already few answers which covers renderings:

Anyway, creating rendering with that specific requirements is not necessary SXA related. SXA doesn't blocks you from using your standard approaches. I would say it is easier as you already have theming in place where you can add css and js files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.