Today marks the beginning of my blogging journey, and Iβm excited to share my first steps with you. For my portfolio and blog, I am using the Astro Nano theme, which provides a minimalistic and efficient framework to showcase my work and write posts.
The basic configuration of my new blog is quite straightforward.
Customizing the Base Site
First, I edited the src/consts.ts
file to set up the basic information:
// src/consts.ts
export const SITE: Site = {
NAME: "My Awesome Blog",
EMAIL: "myemail@example.com",
NUM_POSTS_ON_HOMEPAGE: 3,
NUM_WORKS_ON_HOMEPAGE: 2,
NUM_PROJECTS_ON_HOMEPAGE: 3,
};
Hereβs a breakdown of what each field means:
Field | Required | Description |
---|---|---|
NAME | Yes | Displayed in the header and footer. Used in SEO and RSS. |
Yes | Displayed in the contact section. | |
NUM_POSTS_ON_HOMEPAGE | Yes | Limits the number of posts on the home page. |
NUM_WORKS_ON_HOMEPAGE | Yes | Limits the number of works on the home page. |
NUM_PROJECTS_ON_HOMEPAGE | Yes | Limits the number of projects on the home page. |
Setting Up Page Metadata
Next, I customized the metadata for my homepage:
// src/consts.ts
export const HOME: Metadata = {
TITLE: "Home",
DESCRIPTION: "Welcome to my awesome blog, where I share my thoughts and projects.",
};
This metadata helps with SEO and ensures that my page has a meaningful title and description.
Field | Required | Description |
---|---|---|
TITLE | Yes | Displayed in the browser tab. Used in SEO and RSS. |
DESCRIPTION | Yes | Used in SEO and RSS. |
Adding Social Media Links
I also added my social media profiles to the contact section:
// src/consts.ts
export const SOCIALS: Socials = [
{
NAME: "twitter",
HREF: "https://twitter.com/myprofile",
},
{
NAME: "github",
HREF: "https://github.com/myprofile"
},
{
NAME: "linkedin",
HREF: "https://www.linkedin.com/in/myprofile",
}
];
Each social media link includes:
Field | Required | Description |
---|---|---|
NAME | Yes | Displayed in the contact section as a link. |
HREF | Yes | External URL to the social media profile. |
Blog Collection
The blog
collection is located in src/content/blog
.
Working with the blog
collection:
π /src/content/blog
βββ π post-1
βββ π index.md
βββ π post-2
βββ π index.mdx
In the above example, two static pages will be generated, based on the existence of a classic markdown .md
file or a JSX compatible markdown .mdx
file. The folder name represents the slug:
https://example.com/blog/post-1
https://example.com/blog/post-2
All content must be preceded by required metadata in the markdown file in yaml
format, and be enclosed by triple dashes. ---
---
title: "My cool new title"
description: "A description of my content."
date: "Mar 22 2024"
draft: false
---
Metadata fields:
Field | Required | Type | Remarks |
---|---|---|---|
title | Yes | string | Title of the content. Used in SEO and RSS. |
description | Yes | string | Description of the content. Used in SEO and RSS. |
date | Yes | string | Must be a valid date string (able to be parsed). |
draft | No* | boolean | If draft: true , content will not be published. |
All thatβs left to do is write your content under the metadata.
---
title: "My cool new title"
description: "A description of my content."
date: "Mar 22 2024"
draft: false
---
### Woot
This is a paragraph.
π Congrats, you are now a blogger.
This setup forms the foundation of my blog. Stay tuned for more updates as I continue to build and share my experiences here. Happy blogging!