👨‍💻 Custom HTML Widget

The Custom Html Widget lets you display any custom html in a sidebar.

Follow this guide to install and administer this widget: Installation and Setup

This simple widget will render any html string you enter in the layouts custom html theme setting. No restrictions and no styling, just a simple custom html container.

Content inside custom HTML widget disappears upon loading topic after clicking it from topic list. Visible on topic list, not visible after loading topic.

I want to use more than one instance of this widget on the sidebar. Here’s an example with a Quick-start menu on top and a twitter-feed on bottom, alongside other widgets:

To enable that I set up a branch that allows changing the widget name. In the above example I changed the second instance to “twitter-feed”:

And then it can be selected by it’s own name in the layouts settings:

image

Would you consider merging that feature @angus?

@nolo Keegan is taking the lead on this plugin now. @keegan What do you think? Does this make sense from a long-term perspective?

@angus @nolo

This sounds like a great feature to have, especially for the HTML widget. That being said, I think it would be beneficial to have this across the board for all widgets of the layouts plugin. Perhaps, this is something we could integrate as a core feature for the layouts plugin?

Yup I agree. It would need to be a widget setting rather than a site setting. @nolo would you be interested in making a PR to the layouts plugin along those lines?

Yeah sure! I made the PR and allowed edits on the branch, so you could make any arrangements you’d rather see with this.

Nice! however I don’t see a PR to the layouts plugin?

https://github.com/paviliondev/discourse-layouts/pulls

*edit Ah I see you made a PR to the layouts widget. This will need to be a PR to the layouts plugin and will need to be a widget-specific setting, not a site setting. Feel up to doing that?

Oh my, I just read “widget setting rather than…”. But yeah, you were actually referring to the widget setting of the plugin!

But sorry, I can’t do that. I’m not up to do Ruby code or mess with a plugin so far (or maybe ever :upside_down_face:).

I reckon you could do it :slight_smile:

Approach it by selecting a widget setting that’s similar to the setting you’re trying to add. Do a search for that setting name in the code and make idenical additions, apart from a change in the name. Reasoning by analogy will get you pretty far in this kind of situation.

Then make a PR with that change and @keegan can tell you if you need to make any tweaks.

Ok, thanks for the hints! Will look into it :+1:

So that’s how I understand how re-naming would work:
There’s a theme setting widget name. So I can change the name of the widget right on the component settings. Then I can select the widget by it’s new name on the dropdown at /admin/layouts/widgets. I shared that flow on the screenshots above.

But to have that option show on the component settings, I need to add it to settings.yml of the component, no? If I’d add the option to the plugin, it would show with the other options on /admin/layouts/widgets. But in fact the additional widget won’t show up with it’s new name on the dropdown select, until it already has a new name. So this actually can’t work?

@keegan See if you can help @nolo think this through

Hello @angus @keegan , I was using the previous version of this plugin [ https://github.com/angusmcleod/layouts-custom-html ]. This plugin was giving me an option to update the custom html per category. Could you let us know if this is possible with the current version ?

Hey @Centaur_Arrow, this is currently not possible. However, we will be adding the ability to create multiple instances of a widget soon. In the meantime, take a look at @nolo’s fork of the theme component:
https://github.com/nolosb/layouts-custom-html/tree/set-widget-name

Hello!

This plugin is very cool!

Please add option to set group who can view my custom html widget, for example I want show 2 widget, 1 - only for guest, 2 - only for member :pleading_face::pray:

Hey @TylerDurden,

The feature of adding multiple instances of will be coming soon.

In the meantime, you can install @nolo’s fork of the component (https://github.com/nolosb/layouts-custom-html/tree/set-widget-name) and create two instances of the HTML widget.

You can then configure the exclusive groups setting in the Layouts Settings to control how its shown.
image