News

How to put TikTok videos on AMP pages

TikTok videos are invading the world, and in many cases it is necessary to embed them in an article to give context to the content or to show the most viral that circulates on the platform.

Some CMS, such as WordPress, already allow you to display the video just by putting the URL in the content, although TikTok has a specially designed code to embed the desired material.

This code can be found in each publication, as shown in the screenshot below. We just have to copy it and we will have the video on our website.

How to put TikTok videos on AMP pages

The point is that when we talk about AMP pages, the matter changes, since this code is not compatible. For this, TikTok has just announced , a way to include videos in amp pages in a simple way.

When we use the component we have to use the width, height and data-src variables. The latter is especially necessary as it is the video ID for TikTok or its full URL, both of which can be found on the TikTok source page.

Using the full TikTok URL for the data-src attribute has the added benefit of including a placeholder thumbnail image and includes the TikTok title as part of the tag in the embedded iframe for better accessibility.

AMP, TikTok y WordPress

If you use WordPress and you have the AMP plugin in its version v2.1.4 or higher, the component will be used automatically when you put the embed code mentioned before.

You have more details about the use of AMP in blog.amp.dev, where they are always telling the news of this format designed for quick reading on mobile devices.

Source link

Lenny Li

I started to play with tech since middle school. Smart phones, laptops and gadgets are all about my life. Besides, I am also a big fan of Star War. May the force be with you!

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button