I’m building a proof of concept for a website for a large institution but I have little experience with Enonic XP. Maybe someone can help me with setting up a good architecture for the following usecase:
The website is for a university. The organization is split up in multiple faculties. Each faculty will have it’s own (sub)site.
The faculties have some common elements like employees.
I would like to have a central location to store employee-profile documents and use these on the different (sub)sites.
But the content needs to be shown in the context of the subsite.
For example let assume we have profiles for person A and person B.
Their profiles appear on both the main website and the subsite for faculty X.
The detailpage of the profile should have a url on the main website (the canonical url) and another url on the subsite.
My question is how to solve this in Enonic XP. My approach would be to use the mappings in the site.xml and then fetch the document based on the wildcard in the url. But then how do I get a page layout?
Basically it sounds like you are on the right path with the way XP works today:
Add a pattern mapping to handle employee/* within every faculty site
Whenever linking to employees within a faculty site, create your own url i.e. employee/name or id
Now - The target controller in the mapping should lookup and verify that it actually matching an employee, and then render the page directly (potentially executing another controller). In this caseyou render a page without using regions etc. It is just a good old hardcoded page (no need to configure anything for editors etc). If you are using Thymeleaf fragments, you should easily be able to reuse anything you have used for your regular pages, such as header and footer, and then simply inline the code that renders the employee.
A tip, I would have referenced all the employees in the “main site” with their respective faculty(ies?) site content. This way you can easily search for and make lists of employees within each faculty.
Some more details:
We have backlog items for rendering “parts” programmatically (so you could have re-used an employee part for instance)
since the item is not actually present at this path in the structure you cannot use match mapping for this case (we are working on a concept called clones that will enable this in the future).
thanks! I will try your suggestions.
Your comment got me thinking. It would be nice to use a template (a different one for each site would be best) for the employeepage instead of having it hardcoded. Then I could combine that tempate with the document and render the result.
But if I understand you correctly it’s not possible at this moment, is it?