# 如何始终显示侧边栏作为菜单面板？

**URL:** <https://meta.discourse.org/t/how-to-always-show-sidebar-as-menu-panel/248859>\
**Category:** Development\
**Created:** [2022 年12 月 13 日 22:21 UTC](https://meta.discourse.org/t/how-to-always-show-sidebar-as-menu-panel/248859 "2022-12-13T22:21:15Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

作者： ![kris.kotlarek](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kris.kotlarek/32/176919_2.png) [@kris.kotlarek](https://meta.discourse.org/u/kris.kotlarek)\
发布日期： [2022 年12 月 14 日 06:03 UTC](https://meta.discourse.org/t/how-to-always-show-sidebar-as-menu-panel/248859/3 "2022-12-14T06:03:26Z")

</div>

目前，它无法通过 SiteSetting 轻松配置。

行为由 `NarrowDesktop` 控制

> <https://github.com/discourse/discourse/blob/787655e276b79468fa673401b2792e259128205c/app/assets/javascripts/discourse/app/lib/narrow-desktop.js>

潜在的解决方案是创建一个插件，该插件将覆盖 `isNarrowDesktopView` 函数，使其始终返回 true。

类似 `initializers/always-narrow-view.js`

```javascript
import NarrowDesktop from "discourse/lib/narrow-desktop";

export default {
  name: "always-narrow-view",

  initialize(container) {
    NarrowDesktop.isNarrowDesktopView = () => true;
  }
}

```

---

_[View the full topic](https://meta.discourse.org/t/how-to-always-show-sidebar-as-menu-panel/248859)._
