====== Twitter Integration ====== Creating and using twitter feed in cms page. (Example uses @Twitter feed) **1. Create twitter widget:** * Navigate to [[https://publish.twitter.com/|Widget Creator]] and enter desired twitter page * Select **Embedded Timeline** Now you will get preview of feed you selected and code to implement. The code should look something like this: Tweets by Twitter Copy that code you will need to add it. {{:admin:online-platform-cms:generated-code-twitter.jpg|}} **2. Add to CMS:** * Create or Edit CMS page and add first line from generated code to page content. **Note:** You will need to add this code in HTML mode (by clicking <>) {{:admin:online-platform-cms:add-twitter-code.jpg|}} **3. Add Scripts:** * Navigate to CMS Layout * Add twitter inject let twitterInclude = document.createElement('script'); twitterInclude.setAttribute('src', 'https://platform.twitter.com/widgets.js'); document.head.appendChild(twitterInclude); **Note:** This adds script shown in second line of generated code. * Add event listener to load feed document.body.addEventListener("cmsPageLoaded", function(){ if (document.querySelector('.twitter-timeline')) { window.twttr.widgets.load(); } }); {{:admin:online-platform-cms:updated-scripts.jpg|}}