在这里写一篇教程
这一篇是示例教程,也说明这个网站的教程怎么写。下面的提示框、步骤和代码块,教程里都能用。
每篇教程是 sites/archive/src/content/docs/tutorials/ 里的一个文件,.md 和 .mdx 都可以。文件名就是网址的最后一段:install-node.md 的网址是 /tutorials/install-node。
用到下面的步骤组件就写 .mdx,只有文字和代码的话 .md 就够了。
文件开头是一段 frontmatter:
---title: 安装 Node.jsdescription: 一句话说明这篇教程做什么。sidebar: order: 2---title是页面标题,侧栏里也显示它。description是页面的描述,搜索引擎和分享卡片会用到。sidebar.order决定侧栏里的顺序,数字小的在前。不写就按文件名排。
在本地看效果
Section titled “在本地看效果”-
在仓库根目录装好依赖:
Terminal window pnpm install -
启动教程站的本地服务器:
Terminal window pnpm dev:archive -
打开
http://localhost:4175。文件改了,页面会自己刷新。
提示框有四种,用三个冒号包起来:
:::tip一个小技巧。:::