# 能否将搜索表单放在我们404页面的顶部？

**URL:** <https://meta.discourse.org/t/can-i-put-the-search-form-at-the-top-of-our-404-page/210406>\
**Category:** Support\
**Created:** [2021年十一月29日 14:30 UTC](https://meta.discourse.org/t/can-i-put-the-search-form-at-the-top-of-our-404-page/210406 "2021-11-29T14:30:45Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![cocococosti](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cocococosti/32/231474_2.png) [@cocococosti](https://meta.discourse.org/u/cocococosti)\
**Post date:** [2021年十二月1日 17:22 UTC](https://meta.discourse.org/t/can-i-put-the-search-form-at-the-top-of-our-404-page/210406/3 "2021-12-01T17:22:40Z")

</div>

这样可以吗？

 ![Screen Shot 2021-12-01 at 13.22.18](https://global.discourse-cdn.com/meta/original/3X/a/f/af99f7ac39b28712745d998e6a5e9787bd26410f.png)

我认为可以通过隐藏底部的 `page-not-found-search` 组件并设置 `display: none`，然后使用插件插槽在顶部插入搜索框代码来实现：[Using Plugin Outlet Connectors from a Theme or Plugin](https://meta.discourse.org/t/adding-to-plugin-outlets-using-a-theme/32727)

您还可以添加一些 CSS 来修改文本区域的宽度。请注意，我并没有真正测试过这些，只是直接在浏览器控制台中尝试了一下。

这是搜索框的代码：

```plaintext
<div class="row">
    <div class="page-not-found-search-top">
      <h2>Search this site</h2>
      <p>
        </p><form action="/search" id="discourse-search">
          <input type="text" name="q" value="">
          <button class="btn btn-primary">Search</button>
        </form>
      <p></p>
    </div>
</div>

```

---

_[View the full topic](https://meta.discourse.org/t/can-i-put-the-search-form-at-the-top-of-our-404-page/210406)._
