The translation was generated automatically and may contain mistakes
The recording on the wall
With the help of the record widget, you can embed a separate user or community VKontakte record on your site..
The widget allows users of your site not only to get acquainted with the record itself, but also to instantly evaluate it, share it with friends or subscribe to the author’s page. And thanks to the wide multimedia capabilities of the widget, you can listen to the attached audio recordings, watch videos and view photos without leaving the page with the widget.
Connecting Widget
To add a VKontakte record widget to your site, you need to press the button for the record or comment you are interested in Share in the open window in the bottom right corner click on the link Export of records and copy the insertion code from the open export window. This code needs to be inserted into the page where the widget should be.
Additional settings
Method VK.Widgets.Post It has five parameters:
- •
element_id(string), a mandatory parameter —idthe element that will be the container of the button for communication. Our default constructor uses a valuevk_post_{owner_id}_{post_id}. - •
owner_id(integer), a mandatory parameter is the identifier of the owner of the wall on which the record is placed. - •
post_id(integer), the required parameter is the record ID on the wall. - •
hash(string), a mandatory parameter is a service parameter. Gethashcan only be found in the widget constructor or in the Share window for the selected entry. - •
options(object) — Widget options. An object that may contain the following field:- •
width(integer) is the width of the block in pixels. By default, the write block is stretched the entire width of the page.
- •
Example
<div id="vk_post_1_45616"></div>
<script type="text/javascript">
(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "https://vk.ru/js/api/openapi.js?169"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'vk_openapi_js'));
(function() {
window.VK && VK.Widgets && VK.Widgets.Post && VK.Widgets.Post("vk_post_1_45616", 1, 45616, 'ZMk4b98xpQZMJJRXVsL1ig', {width: 500}) || setTimeout(arguments.callee, 50); }());
</script>Use with AMP
AMP It is a technology that expands HTML Faster loading of content on mobile devices. It allows site owners to quickly and easily generate separate versions of pages for viewing from mobile devices or embedding on other resources.
You can embed a record widget in the AMP version of your site’s page using the tag <amp-vk> . It supports the following attributes:
- •
layoutDetermine the position of content in the document. Values are supportedresponsive,flex-item,fixed; - •
widthThe width of the element inpx(Not taken into account forlayout = responsiveorflex-item); - •
heightThe height of the element inpx(Not taken into account forlayout = responsiveorflex-item); - •
data-embedtypetype of content, for the record widget always containspost; - •
data-owner-id- ID of the owner of the record; - •
data-post-id- ID of the record; - •
data-hash—hashrecords.
For example:
<amp-vk
layout="responsive"
width="500"
height="300"
data-embedtype="post"
data-owner-id="1"
data-post-id="45616"
data-hash="Yc8_Z9pnpg8aKMZbVcD-jK45eAk">
</amp-vk>Description of AMP-VK extension GitHub .
Widget code
To add a widget to your site, simply copy the code to paste to the page you want to place the widget on.