How I create a winning blog in Astro.js
Abdi Abyan

Abdi Abyan @abzresponsible

Joined:
Feb 23, 2022

How I create a winning blog in Astro.js

Publish Date: Feb 20 '24
0 0

Some Prerequisite!

Computer
Some CDM knowledge
Github online version controller
IDE code editor with java
Hosting platform

Step 1

Create the project npm create astro@latest. After which the following file structure will be automatically prepared for you.

astro-
├── public/
│ └── favicon.svg
├── src/
│ ├── components/
│ │ └── Card.astro
│ ├── layouts/
│ │ └── Layout.astro
│ └── pages/
│ └── index.astro
├── tsconfig.json
├── .gitignore
├── package.json
└── astro.config.mjs

or

Create a new project directory then name it astro-blog and cd into it. Then initialize it before installing astro like below.

mkdir astro-blog
cd astro-blog
npm init -y
npm i -D astro

1. Create a new directory for your project and CD into it.

mkdir astro-blog
cd astro-blog

2. Initialize the new project.

npm init -y

3. Install Astro

npm install astro

1. Create the blog post directory

mkdir src/pages/posts

2. Create the compoents directory

mkdir src/pages/posts

3. Create the layouts directory

mkdir src/pages/posts

4. Create the frist blog post

mkdir post1.md

5. Create the pages directory

mkdir src/pages/posts

6. Create the secound blog post

mkdir post2.md

astro-blog/
├── public/
│ └── favicon.svg
├── src/
│ ├── components/
│ │ └── Card.astro
│ ├── layouts/
│ │ └── Layout.astro
│ └── pages/
│ └── index.astro
│ │ ├── post1.md
│ │ └── post2.md
├── tsconfig.json
├── .gitignore
├── package.json
└── astro.config.mjs

7. Start the development server

npm run dev

Now you have all the elements needed for blog. Add more posts or components to enhance the UI interface.

Comments 0 total

    Add comment