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

你好,

现在我看到了这个话题,我想起了我之前看到过关于这个的提交:slightly_smiling_face:

我认为现在应该可以了 :arrow_down_small:

Header

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


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

Common / CSS

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)

Mobile (with no reply)

When someone reply it changes back to the default.

14 个赞