XF 2.2 Embedding a widget into an Article thread?

KensonPlays

Well-known member
I would like to embed a few widgets into an Article to replace the HTML-coded page for my site. I've been able to use an Article thread for pretty much every single other page except the homepage, in which I would like to have a few widgets showing the latest posts and such. I'm not sure how to do this on one single page, but I have these widgets I'd like to put onto JUST the homepage:
Code:
<xf:widget key="forum_overview_members_online" position="sidebar"/>
<xf:widget key="forum_overview_new_posts" position="sidebar"/>
<xf:widget key="forum_overview_forum_statistics" position="sidebar"/>
<xf:widget key="forum_overview_share_page" position="sidebar"/>
<xf:widget key="forum_overview_new_profile_posts" position="sidebar"/>

I've already looked at this thread, and can't seem to understand how to put a widget in a single thread:
 

nocte

Well-known member
o.k. so you defined a single thread as your homepage ("Index page route"), right?

And if you use the code from the linked and put it into this field in the widget options, this does not work?

Bildschirmfoto 2022-06-07 um 23.07.30.png
 

nocte

Well-known member
It does, but then the widgets don't display anywhere else like board listing.
that's expected, if you restrict display with a condition like $xf.reply.contentKey == 'thread-123'. Maybe you can change the condition to;

!$xf.reply.contentKey || $xf.reply.contentKey == 'thread-123'

(untested, but I guess $xf.reply.contentKey will return false, if there's no ID in the url)

Edit: What about adding a new widget instead of changing the existing ones for the forum overview?
 
Top