0 1 00:00:02,680 --> 00:00:07,330 Before we begin just heads up that this tutorial needs a paid plan on Webflow. 1 2 00:00:07,420 --> 00:00:12,530 In this video, we're going to learn how to embed Custom Code in Webflow website. 2 3 00:00:12,530 --> 00:00:17,440 Usually, this is used to insert a third party plugin anywhere on our page. 3 4 00:00:17,440 --> 00:00:23,710 For example, things like calendar components, appointment booking, timers and a lot more. This time 4 5 00:00:23,710 --> 00:00:27,030 we will install a commenting plugin on the blog post page. 5 6 00:00:27,040 --> 00:00:30,210 After this, you will pretty much know how to install any other plugin. 6 7 00:00:30,250 --> 00:00:36,250 Although, each plugin has their own specifications during installation. But those specifications are explained 7 8 00:00:36,250 --> 00:00:42,400 by the plugin providers themselves. Usually providing video tutorials, so once you know what happens on 8 9 00:00:42,400 --> 00:00:46,790 Webflow's site, it shouldn't be difficult to get yourself around the other plugins. 9 10 00:00:46,820 --> 00:00:52,720 The commenting plugin, that we'll be using is called Disqus. 10 11 00:00:52,750 --> 00:00:58,090 For starters, we need to create an account on Disqus and get instructions from there on how to install 11 12 00:00:58,180 --> 00:00:59,930 it in on our website. 12 13 00:00:59,950 --> 00:01:09,640 So go to Disqus.com, that DISQUS.com and click Get Started. Then sign up. 13 14 00:01:13,640 --> 00:01:21,790 Next, you'll get to this gate asking you, if you want to install it on the website. So yeah, choose that. 14 15 00:01:22,010 --> 00:01:25,350 Up next some basic site info like name and category. 15 16 00:01:32,770 --> 00:01:38,800 Disqus has a free version with ads and paid packets without ads. For any website, in the beginning, free 16 17 00:01:38,800 --> 00:01:40,810 version is absolutely fine. 17 18 00:01:40,840 --> 00:01:46,030 That's what I always start with for my clients until there is a big enough traffic to switch to the 18 19 00:01:46,030 --> 00:01:48,740 paid version, which doesn't cost much anyways. 19 20 00:01:48,760 --> 00:01:51,800 Obviously that's for the clients to pay, not us. 20 21 00:01:53,660 --> 00:01:56,100 Next, you'll get this screen to choose a platform. 21 22 00:01:56,120 --> 00:02:01,970 These platforms offer direct integrations, but Webflow isn't on the list. Webflow doesn't usually have 22 23 00:02:01,970 --> 00:02:07,310 any direct plug and play integrations with other platforms and plugins, where you can just click few 23 24 00:02:07,310 --> 00:02:09,250 buttons and start using the plugin. 24 25 00:02:09,320 --> 00:02:14,120 That's expected because Webflow is a little different from others, it's more like coding a website from 25 26 00:02:14,120 --> 00:02:19,790 scratch. And we can manually install the plugin with an ease. So scroll down on the bottom of this list 26 27 00:02:19,850 --> 00:02:21,940 and select manual installation. 27 28 00:02:22,010 --> 00:02:26,560 We'll get this custom code that needs to be inserted directly on our blog post page. 28 29 00:02:26,570 --> 00:02:28,670 Now, let's copy this code and head to Webflow. 29 30 00:02:35,280 --> 00:02:37,850 We're going to add a new div block inside our container. 30 31 00:03:00,070 --> 00:03:03,420 And from the elements panel add a new element called embed. 31 32 00:03:07,660 --> 00:03:13,190 You will instantly open up that code editor, so paste your code in here. For a lot of plugins, 32 33 00:03:13,190 --> 00:03:13,910 that's it. 33 34 00:03:13,910 --> 00:03:16,220 This is where it ends. But not for Disqus. 34 35 00:03:16,220 --> 00:03:19,610 There are a couple edits we have to make to the code itself. 35 36 00:03:19,610 --> 00:03:21,260 First, let's see how it all looks. 36 37 00:03:21,260 --> 00:03:27,710 Note, that custom code embeds usually you cannot see inside the editor or the preview mode. Only on 37 38 00:03:27,710 --> 00:03:29,350 the published website. 38 39 00:03:29,480 --> 00:03:33,590 Webflow doesn't run the code, to make sure it doesn't clash with the Designer. 39 40 00:03:40,350 --> 00:03:42,720 On the live site it's visible, all fine. 40 41 00:03:42,720 --> 00:03:47,160 That message box on top is only visible to us because we're admins of the site. 41 42 00:03:47,160 --> 00:03:51,020 It's asking us, if we want to enable reactions on our site. 42 43 00:03:51,030 --> 00:03:51,660 Maybe later. 43 44 00:03:55,110 --> 00:03:59,640 So that's how it's going to look like, but not yet fully functional. Right now it's static, so it's only 44 45 00:03:59,640 --> 00:04:07,530 going to work on this particular page. And every other comment that we will make on other pages, 45 46 00:04:07,530 --> 00:04:12,330 it's going to be the same, because we haven't really connected this to our CMS. 46 47 00:04:12,570 --> 00:04:15,030 Let's go back to the code and see what we need to change. 47 48 00:04:17,730 --> 00:04:21,350 If you double click on the Embed element, code editor will open up. 48 49 00:04:21,360 --> 00:04:26,280 This is a JavaScript code and inside the code there are comments that tell us exactly what we need to 49 50 00:04:26,280 --> 00:04:33,300 change. First comment says that we need to replace page URL and second tells us to replace page identifier. 50 51 00:04:33,300 --> 00:04:39,570 We just need to make those two changes and then uncomment that section. In JavaScript these symbols, 51 52 00:04:39,630 --> 00:04:46,410 which is slash and the star or two slashes, create comments. But that section is part of the code, so we 52 53 00:04:46,410 --> 00:04:49,830 need to uncomment it. Otherwise it's not going to run. 53 54 00:04:49,890 --> 00:04:50,700 It's quite simple. 54 55 00:04:50,700 --> 00:04:54,740 They are currently wrapped inside the symbols. One in the beginning, one after that. 55 56 00:04:54,900 --> 00:04:57,960 If we remove both, it will turn into functional code. 56 57 00:04:57,960 --> 00:05:02,050 You'll notice this by color change. 57 58 00:05:02,210 --> 00:05:06,920 Next, we need to replace page URL. The page URL needs to be dynamic. 58 59 00:05:06,980 --> 00:05:12,100 It's the URL of the particular blog post. Since we are doing this on a dynamic page, 59 60 00:05:12,110 --> 00:05:19,130 on top of this code editor, we have this button to add a field. Similar as we had inside SEO settings, 60 61 00:05:19,130 --> 00:05:21,880 if you remember. One of the options is a slug. 61 62 00:05:21,890 --> 00:05:25,700 This is what comes after the final slash in the URL. 62 63 00:05:25,820 --> 00:05:31,130 In our case, after blog slash. We can use that to create the URL value. 63 64 00:05:31,130 --> 00:05:37,190 We just need to manually insert everything that comes in front of that slug, and then add slug right 64 65 00:05:37,220 --> 00:05:38,170 next to it. 65 66 00:05:38,210 --> 00:05:41,430 So Webflow will insert the rest of the URL automatically. 66 67 00:05:41,540 --> 00:05:44,460 Just make sure to put this inside single quotes. 67 68 00:05:44,480 --> 00:05:46,930 That's just how JavaScript works, in this case. 68 69 00:05:53,220 --> 00:05:58,610 The page identifier needs to be some unique value that each blog post gets assigned. 69 70 00:05:58,800 --> 00:06:03,890 We can again use slug for this. Because the slug will always going to be unique for each blog post. 70 71 00:06:03,930 --> 00:06:05,640 In this case, just the slug is enough. 71 72 00:06:05,670 --> 00:06:08,570 And don't forget to wrap it inside single quotes. 72 73 00:06:08,730 --> 00:06:13,350 Just final thing to make sure, inside the section below check if the URL of your Disqus site is 73 74 00:06:13,350 --> 00:06:13,980 correct. 74 75 00:06:14,100 --> 00:06:19,050 Sometimes, depending where you copied this code from, instead of your site name it might say, 75 76 00:06:19,050 --> 00:06:21,690 Example.disqus.com 76 77 00:06:21,690 --> 00:06:22,240 ya di da. 77 78 00:06:22,560 --> 00:06:27,960 If that's the case, you'll need to replace that with a short name of your site. Which you can find here 78 79 00:06:27,960 --> 00:06:29,580 inside Disqus admin. 79 80 00:06:33,050 --> 00:06:34,220 Under General Tab. 80 81 00:06:39,010 --> 00:06:43,690 Just copy this and replace the word example with it. To create a proper URL. 81 82 00:06:47,120 --> 00:06:47,750 And that's all. 82 83 00:06:47,750 --> 00:06:51,530 Publish the changes and test the commenting on different blog posts. 83 84 00:06:51,530 --> 00:06:55,080 Works only on the live site. Preview mode is not going to show it. 84 85 00:06:55,100 --> 00:06:57,800 This was probably the most complicated plugging installation. 85 86 00:06:57,800 --> 00:07:00,200 Other plugins are usually simpler than this. 86 87 00:07:00,260 --> 00:07:04,070 Now that you know how to do this, all other plugins should be simple enough. 87 88 00:07:04,130 --> 00:07:09,060 If you ever get stuck, ask for help on Webflow forums, community there is very helpful. 88 89 00:07:09,080 --> 00:07:15,860 You can even tag me on your post to get my help too. My handle on the forums is Vako_Shvili.