在文档项目中使用 Noutious

注意事项

Noutious 只能运行在 Node 侧,请不要直接在客户端组件中调用它。

初始化后的 noutious 导出了 blogdocs 两个项。若想在文档项目中使用 Noutious 作为内容管理系统,你应当使用 noutious.docs

你需要将文档内容放入 Noutious 工作目录下的 docs/ 目录。

查询全部页面

const posts = await noutious.docs.queryPages()

查询特定页面

const categories = await noutious.docs.queryPage(
    // 通过 key 查询页面
    'usage/docs'
);

Noutious 会根据 docs/ 下的目录结构生成对应的 key。如:docs/index.md 的 key 是 indexdocs/usage/index.md 的 key 是 usage/indexdocs/usage/blog.md 的 key 是 usage/blog

查询导航

const tags = await noutious.docs.queryNavigation()