Skip to content

Building a blog with Cloudflare Pages

Posted on:August 23, 2023 at 12:00 PM

The initial stride in setting up the fresh blog involved the selection of a tool for generating static content. Given my inclination towards minimal imagery and limited interactivity, I sought a solution primed for delivering streamlined content with a light digital footprint. Basic functionalities such as Dark Mode and customizable post URLs were essential. Furthermore, compatibility with contemporary publishing services was a priority to evade grappling with infrastructure intricacies.

Engine

With the requirements in mind, I ultimately opted for the Astro engine, finding it to be the most straightforward to set up and aligning perfectly with an accessibility-focused theme that rendered content precisely as desired. Additionally, it demonstrated potential for evolution—a crucial factor. The ability to employ TypeScript caught my interest, as it’s a language I’m genuinely keen on learning, particularly given that its creator also devised my first programming language (Pascal / Anders Hejlsberg).

During testing, page performance yielded a commendable score of 91 for mobile and a perfect 100 for desktop—a promising starting point. The only drawback for the mobile score was the custom fonts, which led to some performance degradation.

The creation process itself is remarkably simple, following the steps outlined on their website. One minor inconvenience was the lack of an option to apply a template post-project creation. I had to start anew by passing the template as a parameter during setup. Nevertheless, subsequent steps involved tweaking data within config.ts and adding my content. Working with the files was straightforward; I’m utilizing JetBrains Fleet as my editor, and it has proven more than sufficient for the tasks with acceptable performance.

A new Domain and other services

With an interest in delving into the Cloudflare platform and gaining a better grasp of its products (I’m an employee, albeit in a different product domain), I opted for the Registrar tool to register the domain—an experience sought after by many developers:

Simple and effective

In a matter of minutes, I registered this domain, and the rationale behind choosing this tool will become evident shortly.

Next up, creating a repository on GitHub—following the steps was a breeze. Opting for a private repository, as I had no intention of making it public, proved to be straightforward. There’s also the GitLab option, which I plan to explore in the future due to curiosity (I’ve had extensive experience with GitLab and have established a connection with it). Now, it’s all about getting everything up and running.

Cloudflare Pages

After having everything set up, creating my webpage was a breeze. With the project and markdown files in the repository, it’s as simple as navigating to the dashboard and indicating that you want to set up a new Cloudflare Pages application. It prompts you to integrate with your GitHub account, and once that’s done, I selected the project type as Astro, and all the fields were conveniently pre-filled.

Though it might sound a bit complex in description, it truly involved answering a series of questions. Essentially, the project configures itself, generating a temporary URL for verification. Honestly, the setup process took around 10 minutes, and I was already able to share a URL with a friend.

Now, here comes the pivotal part: since my domain is under Cloudflare Registrar, I merely had to go to the Pages configuration and request to use a custom domain. Selecting it was all it took, and within 12 minutes – during intervals of checking on whether my child was awake or not – the blog was up and running.

Migrate the old content

I had a bit of work ahead since I wanted to migrate some old content I created 7 years ago on various blogging platforms to this project. I tackled this manually, taking the opportunity to remove sections that no longer appealed to me and simplify their formatting. This process also served as an exercise in understanding how to publish within the platform.

Extra

I took the opportunity to explore another product, one that truly piqued my curiosity and should capture the attention of all – Web Analytics. It leverages access data without relying on a framework or page implementation. Despite having a limited audience, witnessing the numbers update left me nothing short of amazed. Having access to this data with just a prompt to activate is nothing short of incredible.

Results

I’ve been involved in web applications for quite a while, although not as much in recent years due to my focus on iOS development and, at most, API construction. Yet, back when I started with PHP, we used shared servers and FTP. I’ve configured Apache and NGINX on VPS platforms like DigitalOcean and AWS EC2, so I’ve gone through the process of setting up applications in diverse environments.

Cloudflare Pages is a straightforward way to publish a site. It’s designed for developers, and even those with basic web knowledge can comprehend each step. It doesn’t aim to be a Wix; it’s a tool tailored for developers, and I believe it offers a comfortable experience.

So far, my assessment is that the experience and service are highly intriguing. I’m planning to explore Workers to build APIs and small services for mobile apps.

Thanks,

Rodrigo