Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • ssougnez 93 posts 319 karma points c-trib
    Apr 12, 2018 @ 09:31
    ssougnez
    0

    Create document references

    Hi everyone,

    I recently posted this question "https://our.umbraco.org/forum/using-umbraco-and-getting-started/91533-create-a-shallow-copy-of-a-page" and so far, it seems like there is no "out of the box" support for this. However, I think this would be a very useful feature that could be used by way more people than just me. Even though I already explained the idea in the linked post, I'll do it again here in more details.

    Having a tree structure is a very powerful feature of Umbraco that let implementers to display structured data thanks to a simple query. However, in a web site, it can happen that some pages are referenced in more than one single location.

    Let's imagine this simple case. We have an home page, some categories and some products. The content structure would be something like this:

    Home page
       Category 1
          Product 1
          Product 2
       Category 2
          Product 3
       Category 3
          Product 4
          Product 5
          Product 6
    

    The homepage layout just makes a query to retrieve all the categories and display a box for each of them. For each of these boxes, another query is made to retrieve all products of this category and display them as a simple link.

    Currently, this is really easy to do with Umbraco. However, let's imagine that we want to add another category. Maybe something like "Our top product" that should be displayed as the last box. This category wouldn't contain any new product, only product that already exists, so something like this:

    ...
       Our top products
          Product 1
          Product 3
          Product 6 
    

    The problem here is that currently, there is (as far as I know but I might be wrong) no way to do this AND keep the nice structure tree. There are some workarounds as explained in the linked post but not a real solution (once again, I might be wrong).

    So I wondered if it wouldn't be useful to be able to create "document references". Basically, when the user right clicks on a page in the content section, a "Create reference" option would be present. After clicking on it, a dialog such as the one for moving an item appears and ask the user where to put the reference. In our example, we would click on "Product 1", then create a reference that we would put in "Our top products" category.

    Then a reference would be created. I say reference as it is not a new page or something, this is just a structural item that would appear under "Our top products". Besides, when the user clicks on "Product 1" to edit its content, Umbraco should react as if he clicked on "Product 1" under the "Category 1" category. Finally, deleting the main page would either delete all references or maybe show a dialog warning the user about it and ask him to confirm that it is what he really wants.

    The advantages would be that :

    • As this item is included in the tree structure under "Our top products", the query on the homepage that retrieve products of a category would then retrieve as well the products of the "Our top products" category.
    • The job of content editors will be greatly reduced. Indeed, they just have to create pages and references to have a working home page.
    • Deleting a page would remove all references to that page directly, content manager wouldn't have to search for all locations where this product was used.

    Bottom line, this feature would allow the user to structure their site as they are used to while being able to reference a page from a different location than where it really exists.

  • Marc Goodson 2141 posts 14324 karma points MVP 8x c-trib
    Apr 16, 2018 @ 21:09
    Marc Goodson
    1

    Hi ssougnez

    I can see from the other ticket, lots of possible solutions to the products / categories scenario from different people, and that is because there are lots of different ways of associating things in Umbraco that will achieve a result very close to what you are after.

    So I won't offer a further 'this is how I would do it' but...

    ... what you are describing in some places above makes me think of a couple of features in Umbraco that you may not be aware of, and that you could evaluate alongside your aims.

    1) umbracoInternalRedirectId - https://our.umbraco.org/documentation/reference/routing/routing-properties

    If you create a content picker with the magic alias name umbracoInternalRedirectId, on your product document type, then when you create a product in your Top Products category, you can use this picker to pick the product from another category and this will load the content from the picked location (with no redirect)...

    2) Another concept you are nearly describing is Relations.. https://our.umbraco.org/documentation/reference/management/services/relationservice There is an api that enables you to relate different Umbraco nodes together, regardless of where they are positioned in the Umbraco Tree. I don't think this is of use to you here, it's just what you are describing, touched on some of the things Relations can be used for...

    3) IContentFinder - You can implement your own rules for matching incoming urls to Umbraco content: https://our.umbraco.org/documentation/reference/routing/request-pipeline/icontentfinder

    So you could still return products published in a particular category, in a different category product, if you implement the logic here to do the mapping.

    Anyway not sure If that helps, usually for me the key steer on which path to follow, in this kind of implementation, is whether the products can be in more than one category and if they can be, what is the unique canonical url for any particular product page, as usually for SEO reasons you don't really want the same content served under different urls, without specifying a single canonical url for the product.

    regards

    marc

Please Sign in or register to post replies

Write your reply to:

Draft