نمای کلی
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
YouTube Subscribe Button به شما امکان می دهد دکمه Subscribe
به هر صفحه اضافه کنید. این دکمه به یک کانال YouTube پیوند دارد. با کلیک بر روی دکمه، صفحه کانال یوتیوب در یک پنجره جدید باز می شود تا کاربر بتواند اشتراک را تایید کند.
برای افزودن یک دکمه، برنامه شما باید این فایل جاوا اسکریپت را بارگیری کند:
https://apis.google.com/js/platform.js
سپس می توانید با استفاده از عنصری مانند <div>
که class
خود را روی g-ytsubscribe
تنظیم می کند و از ویژگی های دیگر برای سفارشی کردن دکمه استفاده می کند، یک دکمه اضافه کنید. کد زیر یک ادغام ساده را نشان می دهد که دکمه Subscribe
را برای کانال GoogleDevelopers نمایش می دهد.
<script src="https://apis.google.com/js/platform.js"></script>
<div class="g-ytsubscribe" data-channel="GoogleDevelopers"></div>
همچنین میتوانید از Google+ JavaScript API برای نمایش پویا یک دکمه استفاده کنید.
گزینه های پیکربندی
دکمههای زیر گزینههای چیدمان و پیکربندی مختلف دکمههای اشتراک را نشان میدهند. دکمههای کانالهای استاندارد با و بدون تعداد مشترک نشان داده میشوند.
زبان دکمه روی تنظیمات زبان کاربر پیشفرض است یا بر اساس موقعیت مکانی کاربر برای کاربرانی که از سیستم خارج شدهاند تنظیم میشود.
کانال های استاندارد
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-08-21 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-08-21 بهوقت ساعت هماهنگ جهانی."],[],[],null,["# Overview\n\nThe YouTube Subscribe Button lets you add a `Subscribe` button to any page. The button links to a YouTube channel. Upon clicking the button, the YouTube channel page opens in a new window so that the user can confirm the subscription.\n\nTo add a button, your application needs to load this JavaScript file: \n\n```\nhttps://apis.google.com/js/platform.js\n```\n\nYou can then add a button by using an element, such as a `\u003cdiv\u003e`, that sets its `class` to `g-ytsubscribe` and uses other attributes to customize the button. The following code shows a simple integration that displays a `Subscribe` button for the GoogleDevelopers channel. \n\n```\n\u003cscript src=\"https://apis.google.com/js/platform.js\"\u003e\u003c/script\u003e\n\u003cdiv class=\"g-ytsubscribe\" data-channel=\"GoogleDevelopers\"\u003e\u003c/div\u003e\n```\n\nYou can also use the [Google+ JavaScript API](/+/web/api/javascript) to render a button dynamically.\n\nConfiguration options\n---------------------\n\nThe buttons below show different layout and configuration options for subscription buttons. Buttons for standard channels are shown with and without subscriber counts.\n\nThe button language defaults to the user's language settings or is set based on the user's location for logged-out users.\n\n### Standard channels\n\n| Buttons ||\n|-------------------------------|---|\n| Default button | |\n| Default button | |\n| Full layout (includes avatar) | |\n| Full layout (includes avatar) | |\n| Full layout, dark theme | |\n| Full layout, dark theme | |"]]