As a kid we always made websites and tried to make it cool to show off to people. Now I use that skill to get my science out there. A lot of times I realize for technical documentation or marketing purposes it is helpful to have a domain where people can go that is easy to search and that naturally brings web traffic to me. I need to do this cheap since I barely have any funds left for my projects. So here is what I do, I will use Global-Chem’s website https://www.globalchemistry.org/ as an example:
To begin, I will be using Github Pages to host the actual code where each repository is allowed to have one page associated with it. I prepare all the code and have it ready for github with the index.html being at the root of the directory:
Then I go to settings:
Click “Pages” and deploy your code from the main branch:
When you do that, a Github Actions bot will take over and deploy the website for you:
So it’s pretty autonomous already. Now the website goes live usually with some pre-fix domain address like username.github.io but for marketing purposes no one will ever remember or type it in the search bar. We need to make it easy for the user.
To buy custom domains I actually shop on Google, , I’m usually looking for something catchy and you can see how many domains over the years I own:
I’ve tried a lot of different stuff. Now a lot of these domains cost me around 12 dollars per year or 1 dollar per month, I have to be clever here with the words that it’s catchy enough for a user to type but not expensive like globalchemicals.net is $2,200. So buy a domain and then move on to the next step.
I buy my domain and then click “Manage”. Our goal is to take our domain name that we bought and link it to the Github Pages. So when someone goes and types our domain in the search url it reroutes to the Github Page Servers where it the website is hosted.
Next we want to click the tab “DNS” which stands for Domain Name Server where we will handle our configurations.
It’s here that we want to manage our records for how things talk to each other. An “A” record is a dictionary mapping of the domain to the IP address and for github you need to add 4.
185.199.108.153
185.199.109.153
185.199.110.153
185.199.111.153
Once the A records are stored, we want to add our canonical record, CNAME, to the DNS which maps a domain to a subdomain.
That’s it for the google domain side! Let’s go back to your Github Repository . The CNAME file needs to be explicitly added
This here is the subdomain that I bought that I would like the user to type in. Once the CNAME file is added to the root of the repo we go back to Github Pages in the Settings and add “Custom Domain”. When this happens Github will talk to Google and back and forth to make sure there is a valid connection and things are configured correctly.
After that is done, I enforce the https which is the standard for security and voila we have a website! After doing this for a bit it becomes pretty standard in getting a domain and linking it to Github, after your first time it takes like 10 minutes.
Good Luck!