ponzu-cms / ponzu

Headless CMS with automatic JSON API. Featuring auto-HTTPS from Let's Encrypt, HTTP/2 Server Push, and flexible server framework written in Go.
https://docs.ponzu-cms.org
BSD 3-Clause "New" or "Revised" License
5.68k stars 386 forks source link

__addon.go in content folder #242

Closed olliephillips closed 6 years ago

olliephillips commented 6 years ago

Currently need to import the addon into at least one content type after install. This isn't in the documentation (that I can see) and has caught me out a couple of times as I stare at a blank addon page.

What about if ponzu add created an import in say an __addon.go file or similar for each addon that is installed. Addon would be available in ponzu on build automatically? No need to manually add the import?

As you can tell Steve I'm back to Ponzu after a while - hopefully this is helpful stuff and not an annoyance :)

olliephillips commented 6 years ago

Actually this does not seem to work, though the addon appears on the page the addon admin pages does not work (404). Closing

nilslice commented 6 years ago

I initially had a similar thought, but now believe that any addons should be explicitly imported where they need to be used. In my opinion, other CMS projects suffer from enabled, lingering plugins/addons which aren't being used in any meaningful capacity. These plugins bloat the systems and can be exploited. If we require an addon to be used (thus imported), then anything unused wont be linked into the resulting build, minimizing bloat.

But, I am open to other lines of thinking and can see some scenarios where a background addon could be helpful and the decision as to where it is imported and initialized is still unclear.

As you can tell Steve I'm back to Ponzu after a while - hopefully this is helpful stuff and not an annoyance :)

Not an annoyance at all. Very glad to have you back at it!

olliephillips commented 6 years ago

Yes, that makes a lot of sense to me. In the build if being used is much safer. I just need to put a note on my fridge for next time I forget why can't see an addon ;)

nilslice commented 6 years ago

Maybe a short note via the CLI after ponzu add succeeds would help?.. just to remind a user that they need to actually import their addon before it is useful.

olliephillips commented 6 years ago

Looking at it, that sort of goes against the "silent success" approach used throughout Ponzu. Append a note to the long text help instead? I looked at that to first try understand what I'd missed, so it would have helped me being in there.

nilslice commented 6 years ago

That is a great point -- I like your suggestion much better!