How to work with layouts and some general questions about BeaconCMS

I added BeaconCMS to my project and i have a couple of questions.

  • when i create a page within BeaconCMS only Beacon’s layout is applied and as far as i know there’s no way to use phoenix’s default ones, this also goes the other way around and i can’t use BeaconCMS layouts within regular LiveViews
  • can i use functions such as mount/3 and handle_params directly through BeaconCMS?
  • how much stuff that can be written directly with elixir&liveview can be also written within BeaconCMS?
  • how to remove layouts/pages?
1 Like

I got answered on elixir’s slack on the beacon cms channel.

Hey @Wojciech Woźniak

  1. you can pass a :root_layout in beacon_site - see Feature: Makes Host Project Layouts Available via `beacon_site` macro by ddink · Pull Request #431 · BeaconCMS/beacon · GitHub

It’s not fully documented yet because there are some trade-offs with the current solution, beacon expects some functions in the header to work properly (beacon/lib/beacon/web/components/layouts/runtime.html.heex at main · BeaconCMS/beacon · GitHub) so you have to be careful. So consider it as “alpha” while we receive more feedback.2. not directly but you can pass on_mount in beacon_site and also define assigns using live data - see this guide beacon/guides/recipes/on_mount_handle_info_loop.md at main · BeaconCMS/beacon · GitHub
and some page attributes as path/query params are available in @beacon.page, see https://github.com/BeaconCMS/beacon/blob/main/guides/recipes/access-page-info.md3. do you mean sharing the same LV and components between your regular app and beacon? could you give some example?4. not yet possible, a “redirect manager” is on the roadmap so you can delete/unpublish pages properly without impacting SEO

Then i asked:

By “how much stuff that can be written directly with elixir&liveview can be also written within BeaconCMS?” i was asking when starting to use beacon cms for creating pages starts getting inefficient, what liveview features aren’t supported really well within BeaconCMS.It seems that one of those features is mount/3And thanks for the fast answer btw

Second answer:

We have a page in dockyard.com that’s running in Beacon but is not a beacon page. It’s kind of a hack using private APIs but we can work on something official if that becomes a necessity

Thanks Leandro Pereira

1 Like