plone / volto

React-based frontend for the Plone Content Management System
https://demo.plone.org/
MIT License
448 stars 610 forks source link

How to put public folder in an addon? #4654

Closed wesleybl closed 3 months ago

wesleybl commented 1 year ago

I saw in this document that it is possible to put the theme in an addon:

https://training.plone.org/effective-volto/addons/theme.html

How to do the same with the public folder?

Some parts of Volto use the public folder. For example:

https://github.com/plone/volto/blob/2d33eeaa61a0da60d778535ead1f23a148e8f86f/src/helpers/Html/Html.jsx#L126

So, if it is possible to define a public folder in an addon, it would not be necessary to customize the Volto html to change the favicon.

stevepiercy commented 1 year ago

That is an old version (soon to go away because search engines have indexed it). This is the current: https://training.plone.org/effective-volto/addons/theme.html. I don't see that snippet. I think it is OK to close this issue.

Refs: https://github.com/plone/training/issues/672

wesleybl commented 1 year ago

@stevepiercy In the current version, it also doesn't speak to putting the public folder in an addon. So, this issue should remain open, until someone posts a solution.

stevepiercy commented 1 year ago

@wesleybl OK, maybe update the issue description not to refer to these examples, or move this issue to the training repo at https://github.com/plone/training?

wesleybl commented 1 year ago

@stevepiercy I updated the link in the description. I think the place to ask the question is in the Volto repository.

JeffersonBledsoe commented 1 year ago

Hi @wesleybl Is this issue similar #3617? If so, what do you think of this proposal: https://github.com/plone/volto/issues/3617#issuecomment-1279920779

wesleybl commented 1 year ago

@JeffersonBledsoe this is exactly what I was looking for!

I think it's a good idea to overwrite or add public folder URLs. But would the URLs be saved in memory, so you don't have to read the disk with each request?

Do you have an example of middleware definition by an addon? Would he be able to overwrite the public folder URLs?

davisagli commented 3 months ago

This was implemented in https://github.com/plone/volto/pull/6072