Closed data-sync-user closed 3 months ago
Hi Everyone!
After taking a closer look into this, it appears that separating our properties into “sub-sites” similar to MozFest should not be too difficult.
Here are the steps we would need to take:
We need to update https://github.com/MozillaFoundation/foundation.mozilla.org/blob/fb872da801ad8c6715a176dc96742e56ca70beff/network-api/networkapi/wagtailpages/utils.py#L48-L64
Currently, it checks the ancestors of pages to find a page of the model HomePage
. With the new site structure, the PNI homepage and the Donate homepage will no longer be children of a HomePage
model if they are separated into their own sites, resulting in a 500 error.
Something along the lines of:
def set_main_site_nav_information(page, context, homepage_class_name="HomePage"):
"""
Find the homepage, and then record all pages that should end up as nav items. Note
that subclasses can bypass this, because the MozfestHomepage doesn't need any of
this work to be done.
"""
homepage_model = apps.get_model("wagtailpages", homepage_class_name)
root = homepage_model.objects.first()
context["menu_root"] = root
context["menu_items"] = root.get_children().live().in_menu()
return context
should solve the issue!
We will then need to modify the factory files to ensure that these new sub-sites are created when running `inv new-db or when creating review apps.
This can either be done as 1 PR for both new sites (pni/donate) or, we can separate it into 1 PR per site.
Once we have the factory set up for localhost and review apps, we are going to need to make sure that we have the appropriate domains for these new sites on prod and staging.
For example, MozFest lives on mozillafestival.org
on prod and mozillafestival.mofostaging.net
on staging.
We need to decide on the domain name for the new PNI and Donate sites. I will bring this up during tomorrow's Web platform team meeting!
Lastly, once the new sites and domains have been setup, we will need custom migrations or a Python command that take all existing pages, and move them to their corresponding sub sites.
Again, this can either be done as 1 PR for both new sites (pni/donate) or, but I suggest separating them into 1 PR per site.
Closing this ticket as we have created https://mozilla-hub.atlassian.net/browse/TP1-717 to capture the work described above. Thanks!
Describe the feature request
Currently we have
site
objects which are associated with the pages, and the way it is setup now all pages are either part offoundation
ormozfest
. It would be nice to split this up more, probably intofoundation
/pni
/donate
/mozfest
so that we have consistentsite
objects. From the URL standpoint, it's not really important that it lives under thefoundation.mozilla.org
except for being able to create thesite
object in the first place.Using this approach was recommended by Jhonatan, but we would need to investigate to see any secondary effects of this change and the level of effort required to actually do the switch.
Additional context
Initial discussion on this can be found here.
┆Issue is synchronized with this Jira Story