How to Use Embed Code Element in Weebly?
Components of Functions
Adding new functions or modifying the existing feature needs three components:
Using Standalone Embed Code Element
Smaller widgets with simple HTML and CSS code can be directly inserted on the page using embed code element. This is generally referred as inline styling and the result can be immediately seen on site editor without the need of publishing the site. For example, the output can be immediately seen when you add the HTML table code inside embed code element.
Using standalone embed code element is not recommended when you have scripts and larger CSS codes.
Page Level Features
Pasting huge amount of code inside embed code element will drastically reduce the page loading speed. Also the functionality may not work as expected as all parts of codes are placed inside body of the HTML page. It is highly recommended to place the code in the following manner:
- HTML codes inside body of the page using embed code element
- CSS into the header of the page using “Header Code” section of the page
- Scripts just before the closing of body using “Footer Code” section of the page
Site Level Features
Similar to page level features certain times you may need to add features effective at site level. For example, you want to add a custom button on different pages of your site. In this case, the required HTML part needs to be embedded on different pages using embed code element. The common CSS and the scripts can be added in the following manners:
- Paste the CSS and scripts under header and footer code section of the site settings respectively.
- Paste the CSS in “main_style.css” file or upload the CSS files and link them under header code section of the site settings.
- Upload script files and link them under footer code section of the site settings.
Complete Page Structure
The page structure should be like below for fast loading, hence embed the codes as explained above in appropriate places.
Linked external CSS under header code section uploaded in code editor
Embed CSS within <style>…</style> tags
Embed HTML code using embed code element.
Linked external scripts under footer code section uploaded in code editor
Embed scripts using <script>…</script> tags.
Customizing Options for Embed Code Element
Clicking on the embed code element will show you only one option for positioning as shown below.
Basically you don’t need to use separate code within the widget for aligning. Use the positioning options to align the widget left, center or right.
Important Points to Remember Before Using Embed Code Element
Though embed code element offers unlimited opportunities there are certain risks in using it heavily on your Weebly site.
- Sometimes it may affect other default Weebly functionalities. Generally jQuery scripts may conflict with other default scripts on Weebly.
- Weebly support will not help on issues caused by the custom code embedded on your site due to vast scope of the troubleshooting.
- Each piece of embedded code on your site will directly affect the page loading speed. This in turns will impact the search engine ranking and user experience.
Hence, use embed code element at your own risk without expecting any support from Weebly even you are a business plan user.