You have created a website, a YouTube channel and now you want an easy way for visitors to subscribe to your channel. This short tutorial shows a fast and very easy way to add a YouTube subscribe button to your Drual website. The button is created in a custom block so we can put it anywhere on the site.
1. Create a custom block
Go to “Structure” and then “Block layout”. Here we choose the “Custom block library” tab. Click the “Add custom block” button. We are now in the form to create a new block.
Add title. We go with “YouTube Subscribe”
For the body we change the text format to “Full HTML”
2. Get the subscribe button code
Open a new browser tab or window and go to “https://developers.google.com/youtube/youtube_subscribe_button”. This is where we configure our button and get the code. Google populated the fields with their own channel. Start by putting your channel name or ID in the top textfield. Then configure the button to your likings. When you change something you can see your changes in the preview below the settings.
When you configured the button the way you like, we select the code on the bottom of the page and copy it.
We go back to our website browser tab or window and click in the body field. In the body text editor click the button “Source”. We want to to paste as source because we are pasting code and not text. This is very important because if you paste as text it won’t work. Now we paste (ctrl-v) the code we just copied. When we’re done we click save. We return to the “Custom block library” page and see the block we just created listed.
3. Place the block
We now go back to the “Block layout” tab and search for a section we want to put the block in. I’ll go with sidebar first. Click on the “Place block” button in the “Sidebar first” header. In the list we choose the block we just created. I don’t use the title in these kind of blocks so you could uncheck the “Display title” checkbox. Click “Save block” and we should see the block appear in the section.
Go to the bottom of the page and click “Save blocks”
4. See the result
Click on the “Back to site” menu on the top of the page. The frontpage of your website loads again and we should see our YouTube subscribe button appear on the page.