Start trial
Plans & PricingContact Us
Log InStart For Free

How to enable social media embedding in your app

August 9th, 2023

4 min read

Two characters share embedded content

Written by

Joe Robinson

Category

How-to Use TinyMCE

Some of the biggest challenges in creating content are related to design and depth. Your content creation app needs to provide an easy-to-use interface, which helps creators design content that appeals to their audience. As for adding depth – that is, the ability to include useful information – how do you know which functions or options allow for depth and are easy to implement? For example, are social media embeds hard to execute?

The answer boils down to having the right core set of capabilities, in your content creation experience – that is, the right WYSIWYG. When you have that, you can easily embed social media content. For instance, TinyMCE has an easy-to-configure solution for social media embeds. This post explains the essentials of how to give your customers social media embedded content when you have TinyMCE in your app.  

Why embed social media on websites or other platforms?

By providing social media embed capabilities in your app (so that content creators can directly embed primary sources into their content) it opens the path for them to deliver a greater depth of information without interrupting reading flow. In a world filled with distractions, engagement is vital, and any feature that helps keep eyes on a page supports content creation.

How to enable social media embedding with TinyMCE

The Page Embed (Premium) plugin provides an effective way to embed social media content. The advantages of this approach, over attempting to set up anything to do with iframes, are:

  • The ability to configure specific sizes, particularly for responsive sizes for social media embed content
  • The ability to add borders quickly
  • The ability to add scrollbars quickly

You can also configure and adjust how sizes are added to social media embed content (as classes, or as attributes).

Here’s how to get the Page Embed (Premium) plugin working, with an example from Instagram:

First, you need a TinyMCE API key. It comes with a 14-day FREE trial that allows you to test all our Premium plugins, and by adding your API key it removes any domain name errors appearing in the TinyMCE text area. Navigate to the Get-tiny sign up page to get your FREE API key. 

  1. Create an index.html file in your development environment, and paste in the following HTML:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>TinyMCE Demo</title>
</head>
    <body>
    </body>
</html>
  1. With your file open, in the head section, copy and paste the following script tag, and change the “your-api-key” string into your TinyMCE API key:

<script
  src="https://cdn.tiny.cloud/1/your-api-key/tinymce/6/tinymce.min.js"
  referrerpolicy="origin"
></script>;
  1. Add another pair of script tags, paste in the TinyMCE init script:

tinymce.init({
  selector: "#editor",
  plugins:
    "powerpaste advcode searchreplace autolink directionality code visualblocks visualchars image link media mediaembed codesample table charmap pagebreak nonbreaking anchor tableofcontents insertdatetime advlist lists checklist wordcount tinymcespellchecker editimage help formatpainter permanentpen charmap linkchecker emoticons advtable export autosave",
  toolbar:
    "undo redo print spellcheckdialog formatpainter | blocks fontfamily fontsize | bold italic underline forecolor backcolor | link image | alignleft aligncenter alignright alignjustify lineheight | checklist bullist numlist indent outdent | removeformat | code",
  height: "700px",
});
  1. Include a textarea element for TinyMCE to initialize onto. The CSS id value needs to be “editor” to line up with the selector option set in the TinyMCE init script:

<body>
  <form id="post">
    <textarea id="editor">Social media embed test</textarea>
  </form>
</body>
  1. Add the Page Embed plugin to the list of plugins, and the list of toolbars in the TinyMCE init script:

  plugins: 'powerpaste advcode searchreplace autolink directionality code visualblocks visualchars image link media mediaembed codesample table charmap pagebreak nonbreaking anchor tableofcontents insertdatetime advlist lists checklist wordcount tinymcespellchecker editimage help formatpainter permanentpen charmap linkchecker emoticons advtable export autosave pageembed',
   toolbar: 'undo redo print spellcheckdialog formatpainter | blocks fontfamily fontsize | bold italic underline forecolor backcolor | link image | alignleft aligncenter alignright alignjustify lineheight | checklist bullist numlist indent outdent | removeformat | code | pageembed',
  1. Test run the index.html file by opening it in your browser, or use a local server command with Python or with the PHP command.

The TinyMCE demo embed working

With the demo running, you can open the Page embed dialog window by clicking on the Page embed icon, and then pasting in the link to social media content.

  1. Copy the following instagram post link, and paste it into the Page Embed dialog link entry field:

https://www.instagram.com/p/CmUv48DLvxd/embed/

Which results in the following:

TinyMCE embed working in the browser

How to embed Instagram posts in iframes

The instagram link used in the demo had the embed/ suffix added to the URL. The reason why it has that, is so that the Page Embed plugin could render content from Instagram correctly. If you inspect the resulting content inside the TinyMCE text area with the Code plugin, the Instagram post is embedded in an iframe:

Social media embed content working with TinyMCE plugin

It’s another example of how the Page Embed plugin provides easier integration since it automatically wraps content in iframe tags.

Social media embedding popular use cases

The Page Embed plugin can help by allowing easier construction of several popular social media embed use cases:

Video content: Content from video hosting websites can be placed inside the editor for clear videos for supporting content depth.

Audio content: Whether it’s a podcast or Spotify, the Page Embed plugin supports embedding music and other recorded content. Check on the TinyMCE tutorial on creating a CMS, which includes a section on the Page Embed plugin (with Spotify example).

Social Media feeds: Dynamic content is also possible, however some larger social media providers prevent content from their website from being embedded within iframes. Check on the specific documentation for the provider’s website for specific guides on how to embed dynamic content such as profile feeds.

Social media embed for your app and more

By adding the Page Embed (Premium) plugin to your app with TinyMCE, you’re unlocking the ability for content creators to directly link important social media content directly. The time saved in the social media embed process can be put toward building better content, and it saves you handling support requests for comprehensive social media embed features.

Contact our Sales team if you need more information on how Page Embeds, or other plugins and features, can help support your application in providing a comprehensive social media embed solution for your customers.

ConfigurationCMS
byJoe Robinson

Technical and creative writer, editor, and a TinyMCE advocate. An enthusiast for teamwork, open source software projects, and baking. Can often be found puzzling over obscure history, cryptic words, and lucid writing.

Related Articles

  • How-to Use TinyMCEDec 12th, 2024

    Bootstrap Inline Forms: Step-by-Step Instructions | TinyMCE

Join 100,000+ developers who get regular tips & updates from the Tiny team.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Tiny logo

Stay Connected

SOC2 compliance badge

Products

TinyMCEDriveMoxieManager
© Copyright 2024 Tiny Technologies Inc.

TinyMCE® and Tiny® are registered trademarks of Tiny Technologies, Inc.