废话

脑子抽了,想了这个文章。但这个确实适合某些人,比如想要静态效果的站长。但也有没钱买云服务的人(其实更推荐你用Hexo.io

该项目简介

VitePress是一个基于Vite的静态站点生成器,专为技术文档设计。

准备

首先确保你的系统已安装Node.js(版本16或更高),然后按以下步骤操作:

# 创建项目目录
mkdir my-vitepress-blog
cd my-vitepress-blog

# 初始化项目
npm init -y

# 安装VitePress
npm add -D vitepress

# 安装Markdown支持(可选但推荐)
npm add -D @vue/theme

创建基本目录结构(也可以看看文档的,或者你直接看文档新手模式):

114514/
├── docs/
│   ├── .vitepress/
│   │   └── config.js
│   ├── index.md
│   └── blog/
│       └── first-post.md
├── package.json
└── package-lock.json

开始

编辑 .vitepress/config.js文件,配置博客基本信息:

export default {
  title: '我的垃圾桶',
  description: '发史的地方。',
  themeConfig: {
    nav: [
      { text: '首页', link: '/' },
      { text: '博客', link: '/blog/' }
    ],
    sidebar: {
      '/blog/': [
        {
          text: '文章列表',
          items: [
            { text: '第一篇博客', link: '/blog/first-post' }
          ]
        }
      ]
    },
    socialLinks: [
      { icon: 'github', link: 'https://github.com/yourusername' }
    ]
  }
}

然后就是创建首页与博客文章力(喜

---
layout: home
hero:
  name: 垃圾桶
  text: 阿爸阿爸
  actions:
    - theme: brand
      text: 查看博客
      link: /blog/
    - theme: alt
      text: 关于我
      link: /about/
features:
  - title: 技术分享
    details: 分享前端开发、后端架构等技术内容
  - title: 学习笔记
    details: 记录学习过程中的心得与总结
  - title: 项目实践
    details: 实际项目中的经验与解决方案
---

创建第一篇博客文章 docs/blog/first-post.md(其实这个first-post可以改成自己的。)

---
title: 我的第一篇博客
date: 1145-1-10
description: 这是我的第一篇使用VitePress搭建的博客文章
---

# 欢迎来到我的博客

这是我的第一篇博客文章,使用VitePress搭建。

## 主要内容

这里可以开始写你的博客内容...

最后在说一句废话

反正你需要就可以搞啦,如果你想要搞静态博客我还是推荐hexo。

标签: 没有什么用的文章, vitepress, 搭建垃圾

添加新评论