# Insert a glimmer component after first post

**URL:** https://meta.discourse.org/t/insert-a-glimmer-component-after-first-post/303282
**Category:** Development
**Created:** [April 10, 2024, 6:19pm UTC](https://meta.discourse.org/t/insert-a-glimmer-component-after-first-post/303282 "2024-04-10T18:19:56Z")
**Posts on this page:** 1
**Showing post:** 7

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [April 15, 2024, 1:08pm UTC](https://meta.discourse.org/t/insert-a-glimmer-component-after-first-post/303282/7 "2024-04-15T13:08:51Z")

</div>

I’m afraid I may have been a bit over-optimistic here @pfaffman, sorry! The PR I made would introduce a new wrapper `<div>` between every single post, even if the outlet was not being used. That’s not really something we want to do.

There may be ways to avoid the wrapper… but nothing simple which we can do immediately.

So I think the best immediate solution for you is going to be copying the adplugin implementation which you referenced in the OP.

> [@pfaffman](#):
>
> but I couldn’t quite make sense of it

Essentially:

1. Create a component (Glimmer or classic, doesn’t matter) which renders whatever you want

2. Use `registerWidgetShim` to make that component available as a widget. The adplugin example is creating a widget called “after-post-ad”, which renders the `PostBottomAd` component. It is passing all of the widget attributes `(@data)` into the `@model` argument of the component.

3. Use `api.decorateWidget` to render your new widget shim in the `post:after` position. In your case, since you only want it on the first post, you could do something like

When we eventually glimmer-ify the topic page, you’ll need to remove the widget shim/decoration, and replace it with a plugin outlet. That should be pretty easy, since all your display logic in the component will be reusable in the plugin outlet.

Let us know how you get on! Happy to help with any follow-up questions - I know there are a lot of moving parts here.

---

_[View the full topic](https://meta.discourse.org/t/insert-a-glimmer-component-after-first-post/303282)._
