Google AMP amp-instagram

Опубликовано: 12 Апреля, 2022

Добавляя пост в социальных сетях, комментарии - это привлекательные функции на веб-сайтах, которые, как правило, добавляют разработчики, и Instagram, являющийся одной из популярных социальных сетей в 2020 году, встраивание публикации в Instagram пригодится, когда вы хотите привлечь аудиторию. В AMP HTML мы можем сделать это с помощью amp-instagram.

Required Scripts: Importing the amp-instagram header into the header.

HTML

<script async custom-element="amp-instagram" 
</script>

Атрибуты:

  • data-shortcode: находится в каждом URL-адресе фотографии в Instagram. Пример выделенной жирным шрифтом части в приведенной ниже ссылке https://www.instagram.com/p/ CEZCQC-osEP /
  • data-captioned: будет изменен до исходной высоты, включая заголовок.

Example:

HTML

<!doctype html>
<html >
  
<head>
    <meta charset="utf-8">
    <title>Google AMP amp-instagram</title>
  
    <script async src="https://cdn.ampproject.org/v0.js"></script>
      
    <link rel="canonical" href=
  
    <!-- Import the amp-instagram component 
        in the header -->    
    <script async custom-element="amp-instagram" 
    </script>
      
    <meta name="viewport" content=
"width=device-width,minimum-scale=1,initial-scale=1">
      
    <style amp-boilerplate>
        body {
            -webkit-animation: -amp-start 8s 
                steps(1, end) 0s 1 normal both;
  
            -moz-animation: -amp-start 8s 
                steps(1, end) 0s 1 normal both;
  
            -ms-animation: -amp-start 8s 
                steps(1, end) 0s 1 normal both;
  
            animation: -amp-start 8s 
                steps(1, end) 0s 1 normal both;
        }
  
        @-webkit-keyframes -amp-start {
            from {
                visibility: hidden
            }
  
            to {
                visibility: visible
            }
        }
  
        @-moz-keyframes -amp-start {
            from {
                visibility: hidden
            }
  
            to {
                visibility: visible
            }
        }
  
        @-ms-keyframes -amp-start {
            from {
                visibility: hidden
            }
  
            to {
                visibility: visible
            }
        }
  
        @-o-keyframes -amp-start {
            from {
                visibility: hidden
            }
  
            to {
                visibility: visible
            }
        }
  
        @keyframes -amp-start {
            from {
                visibility: hidden
            }
  
            to {
                visibility: visible
            }
        }
    </style>
  
    <noscript>
        <style amp-boilerplate>
            body {
                -webkit-animation: none;
                -moz-animation: none;
                -ms-animation: none;
                animation: none
            }
        </style>
    </noscript>
</head>
  
<body>
    <amp-instagram data-shortcode="CEZCQC-osEP" 
        width="1" height="1" layout="responsive">
    </amp-instagram>
  
    <!-- You can include captions with the 
        `data-captioned` attribute -->
    <amp-instagram data-shortcode="CEQ17teInqd"
        data-captioned width="1" height="1" 
        layout="responsive">
    </amp-instagram>
</body>
  
</html>

Output :

РЕКОМЕНДУЕМЫЕ СТАТЬИ