Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Html custom macros #1424

Closed
wants to merge 2 commits into from
Closed

Html custom macros #1424

wants to merge 2 commits into from

Conversation

nzambello
Copy link
Member

Proposal
I added "macros" to Html.jsx to customize blocks in head and body.

Dev use case: I have to add hotjar or an external resource, but I don't want to customize the entire base Html component, so I can use the macro in that component.

The point is that I don't like to customize a basic component like Html (for maintainability) and I don't have to change anything but only add a part in that.
So, like Plone macros was meant, I added "macros" (let me use this Plone specific term) to Html to allow this.

We'll have dumb components which won't be rendered using the default ones but I can customize those in my projects and Html will be kept untouched.

@tiberiuichim
Copy link
Contributor

If we're gonna introduce these slots, I'd rather this concept formalized into something like the viewlets system so that we can register components from the global configuration and add a bit of smartness by making the components dependent on route. Of course, a component like this could decide by itself if it wants to render or not, but it becomes more flexible (typically you don't want stuff on the View pages also rendered in the Edit pages).

I've worked a bit on this viewlet concept here but there was not "macro slot" declared anywhere, instead I've just relied on Portal nodes. Still, I think it would be nicer to have dedicated, specified, insertion points all over the page.

@nzambello
Copy link
Member Author

I guess we have two different use cases.
This was not meant for UI components, rather to add scripts, link and meta tags.
With viewlet components you're building I would render something for the UI which is more probably location related and you cannot add it in the head.

@sneridagh sneridagh mentioned this pull request Apr 27, 2020
@tiberiuichim
Copy link
Contributor

@nzambello In Plone there is a special viewlet that allows insertion of custom resources in the .

A "slot or viewlet" component could do anything: it can render something visually, it can just require('some.css'), it can render any meta tag, etc. I don't see them as different use cases.

@sneridagh
Copy link
Member

Let's continue the discussion in #1430. See: #1430 (comment)

@tiberiuichim
Copy link
Contributor

I'll close this, as we have the AppExtras now and we're planning the slots as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants