在 Discourse 中显示星级评分非常简单。我很乐意分享,只需几个简单的步骤即可完成。
流程
-
为您的 Discourse 应用设置 Google 标签管理器
-
添加一个包含 JSON-LD 标记的新 HTML 标签
-
按特定 URL 的页面浏览筛选触发器
-
发布,等待 24 小时以在搜索引擎结果页面 (SERPs) 中看到结果。
谢谢
在 Discourse 中显示星级评分非常简单。我很乐意分享,只需几个简单的步骤即可完成。
流程
为您的 Discourse 应用设置 Google 标签管理器
添加一个包含 JSON-LD 标记的新 HTML 标签
按特定 URL 的页面浏览筛选触发器
发布,等待 24 小时以在搜索引擎结果页面 (SERPs) 中看到结果。
谢谢
Interesting. Where are you getting the rating from, Google?
Yes, it is Google SERPs. 
Looks interesting and useful for other types of integrations with tag manager. Can you show what to add in head section of Discourse?
Oh but Discourse has a setting to do that for you. Search settings for GTM.
Good to know, we can add GTM script via Settings. Thanks for the hint about better way.
Updated, above quick guide.
@neil There is one problem when I add GTM script via Discourse settings, it places inside body.
Expected: It should be in the head.
Previously, it was recommended by Google to place in the body.

But now, they have updated their guidelines: “Paste this code as high in the <head> of the page as possible”.
Can we make this possible?
Thanks for pointing that out. Yes we should change it to be in the head. Added to my list.
“As high in the <head> as possible”
…
I think they’re just being greedy there. A normal position in the head should be fine.
Depending on the kind of rating you’re after you can also use the ratings plugin, which automatically adds the average rating for a topic as structured data to the topic page html.
Example from a user here: Topic Ratings Plugin
@Gulshan_Kumar I updated our GTM support today so it adds the code to the head and the body according to the new instructions.
Currently I could not see star rating showing in SERP for above two post.
@Gulshan_Kumar - are you removing star rating in gtm or use any method?
The method which I suggested (using GTM+JSON-LD for star rating) works completely fine. You can continue to use it.
In my case, I intentionally removed from that post due to some personal reason. Nothing else.