Widget Settings

When installing and setting up your widget(s) you need to determine how you want them to behave. Their behaviour is governed by their settings in yoursite.com/admin/layouts/widgets. Let’s go through each of them.

Position

This setting determines where the widget appears on the page. Currently there are only two options, “left” and “right”, which relate to the left and right sidebars. More positions may be added over time.

Order

Order determines the order widgets appear, within a common position, e.g. the order of the widgets in the left sidebar. You can use numbered positions, or “start” and “end” for dynamic positioning (e.g. if some widgets do not appear in certain contexts).

If widgets have the same order value, their order will be determined by the order they appear in /admin/layouts/widgets, however we do not recommend you rely on this. If you want to ensure a specific order, make sure this is represented in the order settings of the relevant widgets.

Context

Context is an “inclusive” setting that must be used for all widgets. You must select the contexts you want the widget to appear in. The “contexts” are the 4 main user-facing contexts in Discourse:

  • Topic List
  • Topic
  • Profile
  • Tags

Filter

Filter is an “exclusive” setting that, if used, restricts the widget to the specified filter(s). If you want the widget to appear for all filters leave this blank. The filters are:

  • Latest
  • Unread
  • New
  • Top
  • Read
  • Posted
  • Bookmarks
  • Categories

The categories homepage is arguably more of a “context” than a “filter”, but it is easier from a technical perspective to make it a filter. It is a unique aspect of the Discourse taxonomy.

Groups

Group is an “exclusive” setting that, if used, restricts the widget to the specified group(s). If you want the widget to appear for all groups leave this blank.

Categories

Categories is an “exclusive” setting that, if used, restricts the widget to the specified categories. If you want the widget to appear in all topic lists, regardless of category, leave this blank.

You can also specify “all categories”, which relates to the topic lists with all categories (shown as “all categories” in the Discourse category selector).

What about the users that do not belong to any group? Such as not logged in users.

After updating to the latest my custom HTML layout is not appearing in incognito mode, but appears fine when I am logged in. I suspect this field may be the culprit.

Could you share a screenshot of your settings? This works fine for the category list widget on thepavilion.io for example. These are our settings.

Screen Shot 2020-07-28 at 9.44.25 AM

Ah, never mind. It must have been some sort of caching issue on Discourse’s end. Now that I checked in a private window, the custom widget appears just fine.

Please feel free to delete my posts if you intend to keep this topic as documentation only. And thanks for your quick response. :slightly_smiling_face:

@angus
may I ask one quick question:
if I leave this blank, will “all categories” and “Uncategorized” be shown in the category list?

Is this a question about what categories will appear in the category list of the Category List Widget? (i.e. like the list on the left side on thepavilion.io) If so, these settings don’t affect that. These settings only affect which categories the widget appears in.

I just want "all categories“ could appear on the left sidebar 。
I think you may have answered my question:

thank you so much

I found what I believe is unexpected behavior.
I limited my Custom HTML widget to trust_level_1. When I’m signed in as a user that is trust_level_0, I do not see the widget. However, when I am not signed in at all, I do see the widget. I would have expected that if a widget is limited to a group, then I wouldn’t see that widget when not signed in. What do you think?

Indeed, that is an issue! Thanks for reporting it. I’ve addressed it in this update.

https://github.com/paviliondev/discourse-layouts/commit/1987f4defc1ae7f5f6b8f8acfdb36f9aba8483cb

Please update and let me know how the fix goes.

It’s working perfectly. Thank you!

Thank you for releasing this plugin and all your others to the public!

It’s working great for me, but I’m just wondering how to add icons to the items in the sidebar?

If you add a “Category Logo” in the category settings, it will be used as the icon in the sidebar.

Is there a way to restrict to guests only?

Not in the settings (you can if you tweak the code of a widget), but that’s a good case for a Feature Request.

Requested. By the way, Layouts is not selectable in the feature request Wizard.

Can you provide an example of how to use the Custom HTML and Profile widgets? I can’t seem to get them to display…

image

image

image

Firstly, you’ll need to assign some contexts to the custom html widget. And currently the only context you’ve got for your profile widget is the profile itself. You probably want Topic List and / or Topic.

Ok I am starting to understand, but I cannot get any topics to display…

What context would apply to the custom html widget? I got this to work by adding the topic_list context but I don’t understand how that applies to the custom html…

Thanks again for your help!

Contexts is where the Custom HTML and Profile widgets would be visible. For example, if you want the Custom HTML widget to appear on profiles and topic lists, then add Profile and Topic List to Contexts.

OH! Now that makes sense! I never claimed to be that smart…lol

Thank you so much!