Adekunle_Odujoko is having trouble mounting the “post-avatar” widget on the “topic-above-post-stream” plugin outlet in their Discourse theme. They’ve tried adding the widget to the outlet using the code:
{{mount-widget widget="post-avatar"}}
However, it doesn’t show up on the page.
awesomerobot suggests that the widget requires additional attributes, such as username, name, and url, to function properly. They provide an example of how to pass these attributes to the widget:
Alternatively, they recommend using the avatar helper to display the user’s avatar:
{{avatar user imageSize="large"}}
Adekunle_Odujoko responds that they intend to display the user avatar above each post on the post page, but are struggling to get the necessary user data into the “topic-above-post-stream” plugin outlet. They’ve tried adding the code to the common/head_tag.html file, but it only displays a trash icon.
After going through this guide " Beginner’s guide to developing Discourse Themes , I tried mounting the post-avatar widget on the “topic-above-post-stream” plugin outlet on the post page and it did not show up on the page
You’re likely missing attributes that the widget requires to show… for example, how does it know which user you want to show the avatar for in this context?
Looking at the original widget here:
it expects:
template
username
name
url
So you’d have to get the data you want into your plugin outlet, then pass it to the widget… something like
that said… what are you trying to achieve more specifically? if you just want to show an avatar, using the avatar helper might be a better way to go… that would look like:
{{avatar user imageSize="large"}}
in this case you’d still need to ensure user is present, because this is how it knows which user to display
I intend on displaying the user avatar above the text of each post on the post page. However I have been unable to get the user data I need into to the “topic-above-post-stream” plugin outlet. Therefore after adding the code below in the common/head_tag.html file a trash icon is displayed on the “topic-above-post-stream” plugin outlet.