Setting up my website

It seemed like a good idea at the time but I decided I needed to have my own website that could be an introduction to who I am and my work and a starting point for people to get to know me. There is so much information out there about creating websites that it can all be overwhelming so I decided to go back to basics. So I starting looking for a simple web content management system that would enable me to get up and running as quickly as possible. At the same time starting looking at the best options for hosting my website.

With all my searches I stumbled upon Cloudflare (https://www.cloudflare.com). This is a essentially a Content Delivery Network (CDN) but their tagline “Cloudflare is a global network designed to make everything you connect to the Internet secure, private, fast, and reliable.” works for me.

Cloudflare Pages is a Jamstack platform (https://jamstack.org/what-is-jamstack/ ) that can be used to develop websites:

  • Jamstack is an architecture designed to make the web faster, more secure, and easier to scale. It builds on many of the tools and workflows which developers love, and which bring maximum productivity.

  • With Jamstack, the entire front end is prebuilt into highly optimized static pages and assets during a build process. This process of pre-rendering results in sites which can be served directly from a CDN, reducing the cost, complexity and risk, of dynamic servers as critical infrastructure.

So given the platform how do I create a website. The Cloudflare documentation provided the answer to this - a Jamstack based tool would allow me to create a website framework and then then just add my content as I went along. So what tool to use - it turns out there are many - all with great names like Gatsby, Hugo, Jekyll and many more. Since I know none of them a google search was my friend and Hugo (https://gohugo.io/) was selected based on the following:

  • Hugo is a static site generator written in Go. It is optimized for speed, easy use and configurability. Hugo takes a directory with content and templates and renders them into a full html website.

The actual website pages are delivered to Hugo using simple text files with markdown https://en.wikipedia.org/wiki/Markdown for formatting and I am already familiar with Markdown so this seemed a good place to start

The practicalities of getting this all and running came down to the following steps:

Create an account on Cloudflare to host the website


So a little bit later I had my website up and running and successfully deployed to Cloudflare. I added a custom domain name and here we are now with my content and I am pretty pleased with it especially since the effort wasn’t huge for the end content

I had to add a few extra pieces to make it all work for me as required. Because this website is to represent me as a Data Scientist I needed to make a couple of tweaks.

The first piece that was important was to ensure that I could insert maths symbols and equations into my pages. While Hugo technically supports this the template I was using didn’t - but it was easy enough to make the changes required (https://docs.mathjax.org/en/latest/web/start.html).

So now I can do stuff like:

$$a_4 \ne b_4$$

\begin{aligned} KL(\hat{y} || y) &= \sum_{c=1}^{M}\hat{y}_c \log{\frac{\hat{y}_c}{y_c}} \ \end{aligned}

\begin{aligned} JS(\hat{y} || y) &= \frac{1}{2}(KL(y||\frac{y+\hat{y}}{2}) + KL(\hat{y}||\frac{y+\hat{y}}{2})) \end{aligned}


The second piece that was important was to ensure I could show code snippets into my pages - that was easy enough once I found out the correct formatting (https://gohugo.io/functions/transform/highlight/)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# Python program to display all the prime numbers within an interval

lower = 900
upper = 1000

print("Prime numbers between", lower, "and", upper, "are:")

for num in range(lower, upper + 1):
   # all prime numbers are greater than 1
   if num > 1:
       for i in range(2, num):
           if (num % i) == 0:
               break
       else:
           print(num)

or

# Python program to display all the prime numbers within an interval

lower = 900
upper = 1000

print("Prime numbers between", lower, "and", upper, "are:")

for num in range(lower, upper + 1):
   # all prime numbers are greater than 1
   if num > 1:
       for i in range(2, num):
           if (num % i) == 0:
               break
       else:
           print(num)

So first project completed - a robust platform that enables me to publish content easily with my own layout and sturcture