Copied to clipboard

Flag this post as spam?

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


  • Gibran Shah 69 posts 240 karma points
    Sep 30, 2020 @ 02:33
    Gibran Shah
    0

    How do get multiple content node to share the same template?

    Hello,

    I'm building an ASP.NET website at http://hollandandbarnes.azurewebsites.net/

    If you go there, you will see an "UPCOMING EVENTS" link in the top nav. It takes you to this page here:

    http://hollandandbarnes.azurewebsites.net/upcoming-events/

    You can also get to Upcoming Events by clicking on "ENTERTAINMENT" and clicking on the "Upcoming Events" thumbnail, which takes you to this page:

    http://hollandandbarnes.azurewebsites.net/entertainment/upcoming-events/

    enter image description here

    We'd like to change this. We'd like both links to go to the same page, this one here:

    http://hollandandbarnes.azurewebsites.net/entertainment/upcoming-events/

    But I'm not sure how to do that in Umbraco.

    Here is my content tree view:

    enter image description here

    Note that there is an Upcoming Events node under Entertainment and another on the same level as Entertainment. And note that on the Info tab, they have different links. If I could just edit the "Links" value, I could set them to have the same value, but it's not editable.

    I understand there's a lot more to it than switching the link. I need to set them to have the same doc type and same template. But when I go to change the doc type of the second Upcoming Event, I get this:

    enter image description here

    It says: "The document type cannot be changed, as there are no alternatives valid for this location. An alternative will be valid if it is allowed under the parent of the selected content item and that all existing child content items are allowed to be created under it."

    The Upcoming Event doc type IS allowed under the parent doc type (Home):

    enter image description here

    ...and I'm not sure what "all existing child content items are allowed to be created under it" means.

    And just to note, the second Upcoming Events content node has these child nodes under it:

    enter image description here

    Not sure if anything needs to be done with these.

    What must I do to get both Upcoming Events to share the same template, and thus go to the same page when the user clicks on them?

    Thanks.

  • Gibran Shah 69 posts 240 karma points
    Oct 01, 2020 @ 04:41
    Gibran Shah
    0

    Surely, this must be possible.

  • Marc Goodson 2155 posts 14408 karma points MVP 9x c-trib
    Oct 01, 2020 @ 08:15
    Marc Goodson
    100

    Hi Gibran

    The 'Upcoming Events' page underneath the 'Entertainment' list isn't' the same document type as the 'Upcoming Events' page, at the higher level - they have different icons...

    but I'm not sure that duplicating the Upcoming Events page at the higher level is the best approach for the situation you are describing or I may be misunderstanding?

    There are a couple of 'routing' property conventions that could help out here:

    https://our.umbraco.com/documentation/reference/routing/routing-properties

    If you added a content picker property with alias umbracoInternalRedirectId to your top level Upcoming Events page and 'pick' the page that has the content you want to display, then visits to the top level page will display the content from the picked page...

    But you will then have two Urls pointing to the same content - so you may want to implement a canonical URL to avoid any SEO penalty.

    The users will see the /upcoming-events URL in their browser.

    Alternatively, you can actually 'redirect' the /upcoming-events to the internal URL that has the content that you want to display, you could use a different routing property - a content picker property with special alias umbracoRedirect - and this would create a temporary redirect (again think about canonical URL for SEO) and the difference here is the URL would change to be /entertainment/upcoming-events in the browser. This would be a temporary 302 redirect...

    so finally another alternative would be to create a new content picker property called permanentRedirect and have a template or event that performs a Response.PermanentRedirect to the other URL issuing a 301 redirect if it's populated, then a canonical Url would be less important - but would make the redirect 'permanent' and cached in peoples browsers !!

    regards

    Marc

  • Gibran Shah 69 posts 240 karma points
    Oct 02, 2020 @ 02:25
    Gibran Shah
    0

    Hi Marc,

    Thanks for the reply. That's a lot to unpack. I'll go through each of your suggestions and see if I can understand how to implement them. Might take a while so I thought I'd reply to say I read your response and appreciate the help.

  • Gibran Shah 69 posts 240 karma points
    Oct 03, 2020 @ 04:35
    Gibran Shah
    0

    Hi Mark,

    I read through the article you pointed me to and tried the umbracoInternalRedirectId property. Works like a charm!

    I've noted your point about the different urls and I may come back to this later to try some of the other properties, but this will do for now.

    Thanks!

Please Sign in or register to post replies

Write your reply to:

Draft