Layouts Plugin

Here you go:

https://github.com/angusmcleod/layouts-custom-html

Works as you would expect a ‘custom html’ widget to. e.g.

Although, the better approach would be building the html by making your own widget file and using virtual dom helpers.

This would be the equivalent of the above example:

import { createWidget } from 'discourse/widgets/widget';
import { h } from 'virtual-dom';

export default createWidget('custom-html', {
  tagName: 'div.custom-html',

  html() {
    return h('iframe', { height: 1000, width: 500, src: 'http://www.milliondollarhomepage.com/'})
  }
})

@Ham I suspect the reason it didn’t work for you is a load order issue. If you change the name of the plugin folder to something alphabetically greater than discourse-layouts, it will work. I’ll address the underlying issue later this week.

1 Like