How to show topic-map on non-commented posts?

Hey, for metric report purposes, I’m trying to see if there’s a setting or CSS implementation to show the topic-map for all posts (even posts that don’t have comments)?


Above is a screenshot of a post not showing any topic-map

Imgur
Above is an imgur showing the topic-map once it has at least one comment

Any insight is appreciated! Thanks!

1 Like

I haven’t tried these out, so I may be mistaken, but there are a few ‘summary’ options in the Admin/Other settings that may tweak what you need:

/admin/site_settings/category/uncategorized?filter=Summary

Sorry, I think I had a brainfart and conflated a couple of different things. :slightly_smiling_face:

2 Likes

I had somebody check out the Admin Settings for me and they said they couldn’t find it. I don’t have access :cry:

There are a few workarounds in this topic (variations of ‘add a post’):

2 Likes

There’s not a setting for this, it requires the topic to have at least one reply. Is there a specific reason you want it to show?

3 Likes

I was thinking about that as a last option type of thing. Don’t really want to add a filler comment/post for the sake of keeping things streamlined.

1 Like

Hey, @awesomerobot
Yes. I am performing weekly metric reports on posts/publications to begin analyzing traffic and engagement with certain topics/teams.

but more specifically, the view count is what you’re after? everything else would show 0:

We’ve had a couple requests for this, so maybe we should work out a mini-topic-map that shows the views in the case where there’s only a single post…

5 Likes

Yes, just the view count. That would help keep the high-priority metrics consistent between all posts.
It would be super awesome if you and your team takes some time to work on something. I’m sure a number of people would appreciate it =)

Hello, I was wondering if it’s possible now to see topic view for post without comments now ?

1 Like

Hello and welcome @Salome_renaud :slight_smile:

You can see them on the main topic list, but I’m afraid it’s still not possible to get a topic map for topics with no replies.

Just a reminder that this is not possible on mobile, so there’s actually no way (that I know of) to see the topic views count on mobile if the topic has no reply.

2 Likes

Hello,

Now that I saw this topic, I remembered that I had seen a commit about this before. :slightly_smiling_face:

I think this should work now :arrow_down_small:

Header

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


I’ve also added a little CSS to hide unnecessary stats when no other posts.

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)
Screenshot 2023-01-05 at 10.10.38

When someone reply it changes back to the default.

11 Likes

But if that’s all you need that is already on the Topic List, why do you need to even go into the Topic view for this metric?

You can even leverage the Top list to sort the Topic List by number of views within a given period …

4 Likes

When topic is not showing in the topic list, then how can we see the views of a topic, that has no replies and is a bit old.

You can filter the topic list for a category and (or) a tag. Because there are lees topics it is easier to find the one you are looking for. Example for your topic.

With the new filter options of Experimental topics list filter feature you can filter the topic list even more. For example you can filter for topics with only one post.
Latest topics with max 1 post

1 Like

@Moin
Thank you very much for suggesting this ‘filter’ route to me. Thanks.

Btw, what’s the diff if I search/filter: “posts-max:-1” and without minus sign: “posts-max:1”