How to move the topic-map widget so it appears above the post's content

(Steven Slade) #1

Looking to alter topic-map but cannot find it in either the post.hbs or topic.hbs. I have tried altering the component template via discourse/templates/components/topic-map.hbs but it does nothing. Perhaps it is because topic-map is a widget now? In which case, where is the widget called?

Ultimately I will be planning on repositioning topic-map to be on top of the post rather than underneath it.

(Steven Slade) #2

I have more or less figured out what I needed to know. Here is what I’ve found for anyone else interested.

Although in the Discourse repo there is still a topic-map component, it doesn’t seem to be called. However, the topic-map widget is very much present is called in the post widget.

In my plugin, I have created the path discourse/widgets/post.js.es6 and copied the contents of the file matching this path from the Discourse repo. Then look for this line hereL result.push(this.attach('topic-map', attrs)); and change push to unshift. This will bring the topic-map to above the post content.

However, unshift brings it to the front of the array, even above details like date posted and the poster’s username. So if you use: result.splice(1, 0, (this.attach('topic-map', attrs))); then it will place the topic-map in a desirable position.