Howto show the topic id in Metadata of initial Post

I tried to display the Topic ID in the initial Post of all topics of a specific category but failed. I could not find a way by configuring Discourse and also a plugin - similar to Discourse BBCODE - failed to work.

Could you please give me a clear hint on how to realize to display the Topic ID in the initial Post metadata of each topic of a specific category?

I need this to continue the customer expectations of the old system as well some related functions and behavior.

Thanks a lot!

The topic_id is at the end of the URL.

Can you say more about what expectations you are tryingto may and what features you need?

As I mentioned in my Post I try to write a plugin, probably the Development category is not the proper place due I don’t want this in Discourse itself. Can you point me to some kind of solution how to display additional (existing) meta data in the initial Post Header?

I know that the URL contains the TopicID as last “Tuple” and there is also a canonical link in the html header that does. I need to display the TopicID on the initial Post. We often speak about “Topic#34074” or something and want to stay with that habit, which our customers and partners are used to.
So I tried to extract the ID (successfully) and past it into the ‘div.topic-meta-data’, which failed.

Add this to Settings > Customize > Common > </head>:

<script type="text/discourse-plugin" version="0.5">
  api.decorateWidget('post-meta-data:after', dec => {
    if (dec.attrs.post_number === 1) {
      const topic = dec.getModel().get('topic');
      return dec.rawHtml(`<div class="post-info topic-id">Topic: ${topic.get('id')}</div>`);
    }
  });
</script>

And you get:

And you just need to add some CSS.

of course, stylesheets are needed! :sunglasses:

exactly what I’m looking for - thanks a lot!!! :hugs:

مرحبًا، سيظهر معرف الموضوع بعد بيانات ما بعد المنشور. أريد أن يظهر بعد عنوان الموضوع، كيف أفعل ذلك؟ شكرًا جزيلاً لك!

يمكنك ببساطة استخدام component-name:after widget-name:after. أو استخدم منفذ إضافة إذا كان متاحًا في الموضع الذي تريده.

لا تأثير :frowning:

<script type="text/discourse-plugin" version="0.5">
  api.decorateWidget('component-name:after', dec => {
    if (dec.attrs.post_number === 1) {
      const topic = dec.getModel().get('topic');
      return dec.rawHtml(`<div class="post-info topic-id">الموضوع: ${topic.get('id')}</div>`);
    }
  });
</script>

هل وضعت حرفيًا component-name widget-name بدلاً من الاسم الفعلي للمكون؟

أريد عرض معرف الموضوع أسفل اسم المستخدم، ما هي widget-name التي يمكنني استبدالها بالكود ؟
شكرًا لك!

مرحباً، من يمكنه مساعدتي :frowning:

هل جربت ما اقترحه فالكو في المنشور أعلاه؟

مرحبًا، كيف يمكننا عرض عدد مرات مشاهدة الموضوع في المنشور؟

مرحبًا، من يمكنه مساعدتي في عرض زر “نقل الرسالة خارج الموضوع”؟

js.user.private_message

مثال: