Custom Domain and Commenting

A quick update about new functions of this website. Two slight changes I have made: relocate the website to a customized domain, and enable the commenting function.

In case you want to know how this website was intially built, I wrote a guide. It’s a simple guide that contains other well-written tutorials and some caveats I’ve encounterd.

Custom domain

Again, I found myself struggling with the terms for a while. Here I provide the basic definitions for the terms not only used in this guide, but probably popping up in other tutorials. These definitions are mostly from the guide provided by netlify.

Terms

  • domain name (or domain for short): full name used to access a site. For example, changyuchang.netlify.com or <!-- -->www.changyuchang.name.

  • custom domain: in this case, a non-netlify assigned domain. Simply speaking, a “website link” that does not have netlify.com as suffix. For example, www.changyuchang.name

  • domain registrar: company that lets you buy and register a domain name. I used GoDaddy without any specific reason.

  • DNS (Domain Name System): a system that translates domain names (basically in English and human readable) to IP addresses (numbers and computer readable).

  • DNS servers (or nameserver): a server where DNS is implemented.

  • DNS provider: company that maintains the DNS servers.

  • hostnames: nameservers that are provided by netlify.

  • HTTPS (Hypertext Transfer Protocol Secure): here is the definition from Google “an internet communication protocol that protects the integrity and confidentiality of data between the user’s computer and the site”. My understanding is … use it to protect yourself and the website!

Now you are ready to set up a custom domain

To be noted, you don’t need to edit any source code to change a custom domain.

  • First, buy a domain you like. I use GoDaddy without any specific reason. Since this domain is for personal website, I chose a domain name changyuchang.name and luckily (this name is not common haha) nobody has registered for it. You can buy the plan whatever the period you want to maintain this domain.

  • Second, go to netlify, the website deployment we used. Go to domain setting and add custom domain. Paste the domain, in my case, www.changyuchang.name.

  • Now netlify asked you to configure the DNS provider. One way netlify provided is to point your domain’s nameservers at netlify. What does that mean? Netlify gave me four custom hostnames, something like dns1.p05.nsone.net, assigned to my DNS zone. Go back to GoDaddy, and edit the DNS of your domain. You will find a section called Nameservers where you can add custom nameservers. Simply paste the four hostnames to this section.

  • This process may take hours. I waited until the next day I modified these settings.

  • Last, encrypt the website by HTTPS. This only requires a simple click on the following section in netlify.

  • Woohoo! Now you have a website domain which is not under netlify domain.

Commenting plug-in

To add the commenting plug-in, you have to change configuration code in your R project.

An external commenting plug-in is needed for the website. Although blogdown does not have an internal commenting function, it and the theme hugo-lithium-theme do have default setting ready for commenting plug-in, which is Disqus. Here is how it works:

  • Sign up in Disqus, and create a new site. Type in Website Name and Shortname. Website Name is not important, but make sure you remember the Shortname. We are going to use this Shortname in the configuration file config.toml (this should be something you are familiar with) in the R project that contains the source code for website.

  • In config.toml of the theme hugo-lithium-theme, there is a option called disqusShortname. Paste the short name in between quotation marks. If you are not sure with the Shortname, go back to the website setting on Disqus and check.

  • Oh oh, don’t commit and push the source code yet. You also have to set up a functional baseurl (the first option in config.toml). This should be the domain for this website, which is, in my case, “https://www.changyuchang.name/”.

  • Now you can commit and push the source code to github. See the commeting plug-in after each post.

There are display configurations that you can play with Disqus, but I haven’t gone through any detail.

Related

comments powered by Disqus