# 如何在非评论帖中显示主题图

**URL:** https://meta.discourse.org/t/how-to-show-topic-map-on-non-commented-posts/204222
**Category:** UX
**Tags:** topic-map
**Created:** [2021年九月22日 17:20 UTC](https://meta.discourse.org/t/how-to-show-topic-map-on-non-commented-posts/204222 "2021-09-22T17:20:39Z")
**Posts on this page:** 1
**Showing post:** 15

<div class="post-metadata">

### Author: ![Don](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/don/32/228726_2.png) [@Don](https://meta.discourse.org/u/Don)
#### Post date: [2023年一月5日 07:21 UTC](https://meta.discourse.org/t/how-to-show-topic-map-on-non-commented-posts/204222/15 "2023-01-05T07:21:03Z")

</div>

你好，

现在我看到了这个话题，我想起了我之前看到过[关于这个的提交](https://github.com/discourse/discourse/pull/19302)。🙂

我认为现在应该可以了 🔽

Header

```xml
<script type="text/discourse-plugin" version="0.8">
  api.includePostAttributes('topicMap');
</script>

```

 ![Screenshot 2023-01-05 at 8.16.48](https://global.discourse-cdn.com/meta/original/4X/a/c/7/ac7a936bd78d77f6449d77f845947bf53d4707b1.png)

* * *

我还添加了一些 CSS 来隐藏没有其他帖子时不需要的统计信息。

Common / CSS

```scss
body:not(.archetype-private_message) {
  .topic-post.regular {
    // if last-of-type is the #post_1
    &:last-of-type {
      article#post_1 {
        .topic-map {
          width: max-content;
          nav.buttons {
            display: none;
          }
          ul li {
            // hide all statistics but views
            &:not(.secondary.views) {
              display: none;
            }
          }
          // show views on mobile view
          .secondary.views {
            .mobile-view & {
              display: list-item;
              text-align: center;
            }
          }
        }
      }
    }
  }
}

```

Desktop (with no reply)

 ![Screenshot 2023-01-05 at 10.08.58](https://global.discourse-cdn.com/meta/original/4X/0/3/9/039fa3c225fdefb950dfce58b2df1e89eab93d8f.png)

Mobile (with no reply)

 ![Screenshot 2023-01-05 at 10.10.38](https://global.discourse-cdn.com/meta/original/4X/a/4/8/a48dceda2b271615043c1ccabab5f60aea40de24.png)

When someone reply it changes back to the default.

 ![Screenshot 2023-01-05 at 10.14.46](https://global.discourse-cdn.com/meta/original/4X/3/2/8/328274fef17d3409f3b6a5bed52880aaf297cde9.png)

---

_[View the full topic](https://meta.discourse.org/t/how-to-show-topic-map-on-non-commented-posts/204222)._
