maglevhq / maglev-core

Ruby on Rails website builder
https://www.maglev.dev
MIT License
273 stars 47 forks source link

Discussion: Can pages be related to models? #29

Closed silva96 closed 2 years ago

silva96 commented 2 years ago

Hey Didier, I want to check if the gem can be adjusted to our needs:

We have a platform where users can create their own e-commerce site under a subdomain of our app.

Example: https://carpatitashomeschool.salduu.com/

There, users have an store front with their products and currently each product has its own page

Example: https://carpatitashomeschool.salduu.com/p/descubrimiento-de-america-para-ninos

Those pages are composed by a fixed erb view that renders a action_text field called "description"

I thought I could enhance the basic "description" and offer the ability to create a full featured landing page for the product using maglev.

Like in the product edit form offer them

[on/off] User the new page builder

That would launch the maglev editor for that specific product

So in the model it could be something like

Product has_one :maglev_page, optional: true

and in the view it could be

<% if product.maglev_page.present? %>
  <%= render full_featured_maglev_page %>
<% else %>
  <%= render partial: old_fixed_page_with_action_text_description %>
<% end %>

I also don't want anyone to create their page and override any of my pages / or other user pages, so "pages" don't need to have a path (*can't have), because the path is bound to the product_path

Do you think this is possible? I think it is a very common use case.

did commented 2 years ago

👋 @silva96. Of course I was aware of that use case but since I haven't faced it yet myself in my applications, I avoided to implement it.

My concern was about how you deal with the "unicity" of the product page / template. Sorry, it's quite confusing. Let me explain.

So let's say you've got a Product model and you already installed Maglev to handle the other pages of your e-commerce site. And you've got 2 products: Product A & Product B.

How different should be the 2 product pages?

Should they have the same sections, like a banner maybe, a product detail section which should be required and maybe dynamic sections that might appear on the Product A page but not on the B one. For instance, should the banner section share the same content between the 2 products? Or do you have to treat the 2 products like 2 separate pages? Do we want the content editors to require the "product details" section at a specific position of the page.

I think you got the idea, there are quite a few scenarios which depends on lot of the context.

This why I need feedbacks from users like you before tackling the right implementation :-)

silva96 commented 2 years ago

Actually our use case is much more simple. Each product is a unique page that can be built from zero and can have dozens of sections and blocks.

They want to have something more like a product landing page instead of a regular ecommerce product page.

Our users sell infoproducts and they are using costly themes built for wordpress and redirect traffic to our payment gateway.

I want them to have the page editor inside the platform instead.

For instance, this is built outside our platform but users want something like this (wordpress or similar).

https://soyfunnelbox.com/oferta

Currently our users can only have pages like this (our platform)

https://carpatitashomeschool.salduu.com/p/descubrimiento-de-america-para-ninos

did commented 2 years ago

I see. This is a special case in my point of view. A product -> a landing page. An user can have one or many products. In that right?

First thing, Maglev (MIT version) is only mono-site. So the open source won't work for your use case. The Maglev PRO which is multi-sites (so multi-landing pages in your case) will.

In other words, your Maglev site (and not page, this is the difference) will belong to a product.

I guess you could trick the system and try to use the MIT version of Maglev with the idea of that a page belongs to a product. First you'll fight against the Maglev framework and then, you'll get some unwanted side-effects like your users will see other asset's users because they share the same site. You see what I mean?

silva96 commented 2 years ago

Yes I see it, I actually made a concept proof on that path and kind of worked but felt very hacky, I will probably build a minimalist version of a page builder inside the platform near in the future. Thanks for the clarifications!