Skip to content

LimChaeJune/astro-fox

Repository files navigation

Astro Fox Preview

Astro Fox 🦊

License: MIT Contributors PRs Welcome Lighthouse Score: 100

ν•œκ΅­μ–΄ πŸ‡°πŸ‡·

Astro Fox is a fast and lightweight Astro template generator for blogs and portfolios. Easily start your project with CLI tools and quickly build a personal site with blog, log, and project sections.

Deploy with Vercel Deploy to Netlify

✨ Features

  • πŸš€ CLI Generator: Create new projects with simple commands
  • 🎯 Perfect Performance: Lighthouse 100/100 score
  • πŸ” SEO Optimized: Built-in SEO best practices (meta tags, Open Graph, sitemaps)
  • πŸŒ“ Dark/Light Mode: Automatic detection of system theme with manual toggle
  • πŸ“± Responsive Design: Optimized experience on all devices
  • πŸ”Ž Integrated Search: Fast content search with pagefind
  • πŸ“ Markdown & MDX: Convenient content writing
  • 🧩 Modular Components: Built with SolidJS components
  • πŸ’¨ Smooth Animations: Appropriate transition effects
  • πŸ“Š RSS Feed: Automatically generated RSS feed

βœ… Performance

Lighthouse Score 100/100

Perfect Lighthouse scores across all categories: Performance, Accessibility, Best Practices, and SEO.

πŸš€ Getting Started

Start with CLI

# Install globally with npm
npm install -g @cj.lim/astro-fox

# Create a new project
astro-fox init my-blog

# Navigate to project folder
cd my-blog

# Start development server
pnpm run dev

Start with Clone

Astro Fox uses pnpm by default, but supports all major package managers (npm, yarn, pnpm). Choose one package manager and use it consistently throughout these commands.

# Clone repository
git clone https://github.com/LimChaeJune/astro-fox

# Navigate to project folder
cd astro-fox

# Install dependencies with your preferred package manager
pnpm install

# Start development server
pnpm run dev

# Build for production
pnpm run build

Available Scripts

The following scripts are available regardless of which package manager you choose:

# Start development server
pnpm run dev

# Build for production
pnpm run build

# Preview production build
pnpm run preview

# Run ESLint
pnpm run lint

# Fix ESLint issues
pnpm run lint:fix

# Format code with Prettier
pnpm run format

# Check formatting with Prettier
pnpm run format:check

πŸ“ Project Structure

/
β”œβ”€β”€ cli/                  # CLI tools
β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ fonts/            # Web fonts
β”‚   └── js/               # Client scripts
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ components/   # App common components
β”‚   β”‚   β”œβ”€β”€ layouts/      # Layout components
β”‚   β”‚   └── styles/       # Global styles
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ blog/         # Blog-related components
β”‚   β”‚   β”œβ”€β”€ log/          # Log-related components
β”‚   β”‚   β”œβ”€β”€ project/      # Project-related components
β”‚   β”‚   β”œβ”€β”€ common/       # Common UI components
β”‚   β”‚   └── about/        # About page components
β”‚   β”œβ”€β”€ content/
β”‚   β”‚   β”œβ”€β”€ blog/         # Blog posts (Markdown/MDX)
β”‚   β”‚   β”œβ”€β”€ log/          # Log entries (Markdown/MDX)
β”‚   β”‚   └── projects/     # Project information (Markdown/MDX)
β”‚   └── pages/            # Astro pages
β”‚       β”œβ”€β”€ index.astro   # Home page
β”‚       β”œβ”€β”€ blog/         # Blog pages
β”‚       β”‚   β”œβ”€β”€ index.astro           # Blog list page
β”‚       β”‚   └── [...slug].astro       # Dynamic blog post page
β”‚       β”œβ”€β”€ log/          # Log pages
β”‚       β”‚   β”œβ”€β”€ index.astro           # Log list page
β”‚       β”‚   └── [...slug].astro       # Dynamic log entry page
β”‚       β”œβ”€β”€ projects/     # Project pages
β”‚       β”‚   β”œβ”€β”€ index.astro           # Project list page
β”‚       β”‚   └── [...slug].astro       # Dynamic project detail page
β”‚       └── about/        # About page
β”‚           └── index.astro           # About page
└── package.json

Dynamic Routes with [...slug]

The [...slug].astro files are used for dynamic routing in Astro:

πŸ“– CLI Usage Guide

Astro Fox CLI is a tool for quickly creating and configuring new projects.

# install @cj.lim/astro-fox
npm install -g @cj.lim/astro-fox

# Create a new project
astro-fox init <project-name>

# Create a new blog post
astro-fox blog "My New Post" -d "A short description" -t "tag1,tag2"

# Create a new log entry
astro-fox log "Daily Log" -d "What I did today" -t "work,learning"

# Create a new project entry
astro-fox projects "Project Alpha" -d "Details about the project" -c "MyCompany" -s "2024-01-01" -e "2024-12-31"

# View help
astro-fox --help

# Check version
astro-fox --version

πŸ”§ Customization

Content Writing

All blog posts are stored in src/content/blog as Markdown or MDX files. Each post needs frontmatter with the following fields:

---
title: "Post Title"
summary: "Brief description"
date: 2024-04-07
tags: ["astro", "web development"]
categories: "category"
image: "image-path" # optional
draft: true # optional
---

Content goes here...

The frontmatter schema is defined in src/content/config.ts using Astro's Content Collections API. You can check and modify the schema definitions there.

Logs and Projects

  • Logs are stored in src/content/log.
  • Projects are stored in src/content/projects.

Styling

This template uses TailwindCSS. You can customize the theme by editing tailwind.config.mjs.

πŸ› οΈ Key Configuration Files

These files should be modified to personalize your site:

Astro Configuration - astro.config.mjs

export default defineConfig({
  site: "https://yourdomain.com", // Replace with your domain
  build: {
    format: "file", // build format
    inlineStylesheets: "auto", // css optimization
  },
});

Favicon Image - public/favicon.svg

Content Collection Schema - src/content/config.ts

Colors, Fonts and Design Elements - tailwind.config.mjs

🚒 Deployment

Astro Fox is based on static site generation (SSG) and can be easily deployed to various hosting services:

  • Vercel: Connect Git repository for automatic deployment
  • Netlify: Connect Git repository or deploy with drag-and-drop
  • Cloudflare Pages: Connect Git repository for automatic deployment

πŸ™ Acknowledgement

Theme inspired by Astro Sphere.

πŸ“œ License

MIT