Cloudflare Astro Tutorial – Important Astro Website Settings

In this article, I will share some very important and crucial settings you must change in your Astro website built on Cloudflare. These changes will make sure that the basic astro template is tuned for your brand. We will change the Site Title, Default Description, add Favicon, important meta tags, Website sitemap, and more. The required code is also added for those who do not have a coding background.

How to access the Website Source Code

On Cloudflare, the Astro website is built using the public or private repository. I have already created a detailed video on how to do it; you can watch the full tutorial using this link.

Once you set up your basic Astro website template, the first thing you need to do is go to your Cloudflare Workers dashboard and access the GitHub repository.

Setting 1 – Site Title and Description

To change the site title and description/tagline, go to the src>const.ts file in your repository. in this file, you will find the following code –

Now all you have to do is replace the “Astro Blog” with your website title or brand name and “Welcome to my website!” with the tagline of your website. This will be the default website title and tagline of your website.

Website BaseHead and Favicon

Another important setting we need to change is in the BaseHead. BaseHead is a reusable component that injects essential code for SEO and core website information. You can find the file in src/components/BaseHead.astro.

Important

The astro website framework supports the .astro and .md file types. The .md is a markdown format which is more secure compared to HTML and CSS in preventing attacks.

In the BaseHead.astro, you should see the following code by default –

Most of the code here remains unchanged; it injects important meta tags for SEO of your pages and blog articles. Replace the existing code with the following code that adds a favicon and default image to the page.

Leave a Reply