# 以编程方式自定义侧边栏

**URL:** <https://meta.discourse.org/t/making-custom-changes-to-the-sidebar-programmatically/273027>\
**Category:** Development\
**Tags:** rest-api, sidebar\
**Created:** [2023 年7 月 27 日 09:14 UTC](https://meta.discourse.org/t/making-custom-changes-to-the-sidebar-programmatically/273027 "2023-07-27T09:14:04Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![awesomerobot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awesomerobot/32/142900_2.png) [@awesomerobot](https://meta.discourse.org/u/awesomerobot)\
**Post date:** [2023 年7 月 27 日 12:54 UTC](https://meta.discourse.org/t/making-custom-changes-to-the-sidebar-programmatically/273027/2 "2023-07-27T12:54:41Z")

</div>

> [@literarymachine](#):
>
> 如果有一种方法可以以编程方式修改侧边栏，那将是非常棒的！

我们还构建了一个用于添加自定义侧边栏部分的 API

这里有一些示例：[discourse/app/assets/javascripts/discourse/app/lib/plugin-api.js at 00ab94bf53b784478d0aa7744bf3bb2d5b527580 · discourse/discourse · GitHub](https://github.com/discourse/discourse/blob/00ab94bf53b784478d0aa7744bf3bb2d5b527580/app/assets/javascripts/discourse/app/lib/plugin-api.js#L2036)

这被标记为实验性的，但应该可以安全使用（例如，当启用聊天时，我们使用它将聊天内容添加到侧边栏）

---

_[View the full topic](https://meta.discourse.org/t/making-custom-changes-to-the-sidebar-programmatically/273027)._
