Kindly correct me if I'm wrong posting it here. But I just wanted an opinion with this implementation I have:
So, in Sitecore
, we have multisite:
-Site1
-Site2
-Site3
And we have a separated node for all of the Functionality
of a site. From each of the Functionality
, we have a field called Visible to Site
wherein a multiple choice
of the sites (e.g. Site1
, Site2
, Site3
) indicating into what sites this particular Functionality
is available. Sometimes, a Site
shares similar Functionality
from other Sites
. Hence, all that are under Shared folder
. All in all, it looks like this:
-Site1
-Site2
-Site3
-Data
- Functionality
-Shared (this is a folder only)
-IT
-Sales
-Management
-Site2 (this is a folder only)
-Construction
-Games
-Sales
BUT, noticed Sales
under Site2
folder, this Sales have different content on it. (e.g. image). This is different to the Sales
from Shared folder
.
The Problem
now based on this not so good current implementation is when we navigate Site2's Functionality Sales
, it will be redirected to the Sales
from the Shared folder
because they have same name and Sitecore
only renders the first one.
Proposed Solution
I will add a template with a field called
BasedFieldForItemResolve
(lol too long) --> This field represents thename/id
of the field that I can use. From my sample, I can use the fieldVisible to Site
of theFunctionality
item. This template will be added as aninherited template
ofFunctionality
template.From my
custom item resolver
, I am checking the fieldBasedFieldForItemResolve
if it has value. If there's no value, the item resolver will run as-is. But if it has a value, I will only get the item with the same value of the currentcontext site
var fieldForItemResolve = result.First().GetField("BasedFieldForItemResolve"); if(fieldForItemResolve != null && fieldForItemResolve.HasValue) { var siteRoot = Context.Database.GetItem(Context.Site.RootPath); if (siteRoot != null) { var filteredBySite = result.FirstOrDefault(x => new ID(x.Fields[fieldForItemResolve].ToString()) == siteRoot.ID); if (filteredBySite != null) Context.Item = Context.Database.GetItem(filteredBySite.ItemId); } }
If the BasedFieldForItemResolve
is existing to the current item and the value of it is not null, I will get the value of it (and from the sample scenario, the value is Visible to Site
)
My concern is regarding SEO, I'm wondering if it will be an issue
P.S.
We are using Helix
. The above structure was just an overview of the content tree
. There are Data folders
inside each sites and outside of them. The Data folder
outside of the sites was made like that for reusability (I think that was the reason)