惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

H
Hackread – Cybersecurity News, Data Breaches, AI and More
C
Check Point Blog
Hacker News: Ask HN
Hacker News: Ask HN
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
WordPress大学
WordPress大学
P
Proofpoint News Feed
V
Visual Studio Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
N
Netflix TechBlog - Medium
C
CXSECURITY Database RSS Feed - CXSecurity.com
博客园 - 聂微东
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
博客园 - 叶小钗
Cisco Talos Blog
Cisco Talos Blog
S
Schneier on Security
T
Threat Research - Cisco Blogs
腾讯CDC
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
The Hacker News
The Hacker News
Google DeepMind News
Google DeepMind News
Microsoft Security Blog
Microsoft Security Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
GbyAI
GbyAI
N
News | PayPal Newsroom
L
LINUX DO - 最新话题
酷 壳 – CoolShell
酷 壳 – CoolShell
P
Palo Alto Networks Blog
T
Tenable Blog
S
Secure Thoughts
T
Threatpost
V2EX - 技术
V2EX - 技术
大猫的无限游戏
大猫的无限游戏
Martin Fowler
Martin Fowler
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Vercel News
Vercel News
罗磊的独立博客
P
Privacy & Cybersecurity Law Blog
Engineering at Meta
Engineering at Meta
小众软件
小众软件
Google DeepMind News
Google DeepMind News
N
News and Events Feed by Topic
Y
Y Combinator Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
C
Cybersecurity and Infrastructure Security Agency CISA
P
Proofpoint News Feed
L
Lohrmann on Cybersecurity
P
Privacy International News Feed
H
Heimdal Security Blog
量子位
B
Blog

AsyncX

V3 博客重构 第三期-用Notion进行网页收藏/订阅管理/阅读数据查看 使用MCSManager搭建泰拉瑞亚服务器 额外技能-如何穿手串 [更新]首考PTE的一些问题/快速入门 重构博客,底层换成Astro时候遇到的问题 熵,生命 如何使用Mac玩双人成行 解决手柄无法在Macbook玩星露谷的问题 什么在阻止我们走向主观来说更好的生活? 雅思首考的一些感受 如何听更好音质的歌 苏州三天行 毕业,以及短期的安排 近日&首阳 第一期-Beancount使用体验 在MacOS配制Rime(鼠须管)输入法 更换主力浏览器为Arc浏览器 为hexo博客添加黑暗模式(使用darkmode.js) 语言规范可以帮你更好得到答案 删掉抖音,重拾RSS 简单注册ChatGPT的方法 2023年,一些回顾 让你的MacBook更顺手一点 第一次养猫发现的一些事 绑架代替购买了一只小猫 数字藏品? 近些天和对于科幻的一些看法 如何配置一个静态博客的工作流
第二期-Vitepress配制指南
AsyncX · 2024-01-10 · via AsyncX

前言

前段时间用Docsify感觉侧边栏的并不舒服,不想用md渲染html,但是没想到Vitepress的速度可以这么快。

Library

安装

我的包管理本来打算用npm + yarn(npm实在一言难尽),但在部署到Cloudflare上的时候出现了冲突。因此本指南统一使用npm部署到Cloudflare进行。如果你只想获得更多有用的配制,请转到:配制

前置准备

npm add -D vitepress

安装向导

VitePress 附带一个命令行设置向导,可以帮助你构建一个基本项目。安装后,通过运行以下命令启动向导:

npx vitepress init

默认如下,注意./docsDefault Theme + Customization为后续的默认配制.

┌  Welcome to VitePress!

◇  Where should VitePress initialize the config?
│  ./docs

◇  Site title:
│  My Awesome Project

◇  Site description:
│  A VitePress Site

◆  Theme:
│  ● Default Theme (Out of the box, good-looking docs)
│  ○ Default Theme + Customization
│  ○ Custom Theme

一切顺利的话运行

npm run docs:dev

即可在本地的http://localhost:5173看到网页。

部署到Cloudflare

在官方的配制教程里是简单带过的:

Netlify / Vercel / Cloudflare Pages / AWS Amplify / Render

使用仪表板创建新项目并更改这些设置:

  • 构建命令: npm run docs:build
  • 输出目录: docs/.vitepress/dist
  • node 版本: 18 (或更高版本) 这里详细说一下用Cloudflare的Pages部署 构建命令依旧,构建输出目录依旧,我在手动为环境变量添加NODE_VERSION=18.0的时候部署失败了。因此建议在本地Vitepress项目文件夹根目录创建.nvmrc
18.17.0

之后进行构建即可。

::: danger 你需要关闭Cloudflare的网页压缩加速功能!不然会删掉部分的Vue格式导致文件加载异常! :::

配制

为主页标题添加彩色字

前文的创建中我的建议是自定义部分css。 编辑.vitepress/theme/style.cssline: 473/474

:root {
--vp-home-hero-name-color: transparent;
--vp-home-hero-name-background: -webkit-linear-gradient(120deg, #53ffe2, #9d25d9); 
--vp-home-hero-image-background-image: none;
--vp-home-hero-image-filter: none;
}

为Vitepress添加自动侧边栏

Github: vitepress-sidebar

安装

npm i -D vitepress-sidebar

配制

修改.vitepress/config.js

sidebar: // [!code --]
sidebar: generateSidebar({ //自动sidebar
	text: 'Guide',// [!code --]
	items: [// [!code --]
		{ text: 'Introduction', link: '/introduction' },// [!code --]
		{ text: 'Getting Started', link: '/getting-started' }// [!code --]
	]// [!code --]
	collapsed: true, //自动折叠
	documentRootPath: '/docs', //自动读取根目录
	useTitleFromFrontmatter: true, //读取fontmatter的标题属性,如果没有使用文件名
})

重新运行npm run docs:dev后你就会发现侧边栏已自动更新.