Copied to clipboard

Flag this post as spam?

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


  • Nelson 94 posts 246 karma points
    Jun 07, 2016 @ 10:49
    Nelson
    0

    Parent Child articles with links to other pages

    Hello,

    I've been using the articles parent and article child in some of my pages in my website, everything works perfectly, except for the linking to the pages. As I'm adding the same item in other of my pages, and I dont want to create new child arcticles (because they would be duplicated), Im redirecting through href to the page I select in "Content Picker". But somehow the link on the href doesnt correspond to the one I select on the backend. Why is this happening? How can I solve it?

    So instead of using <a href="@post.Url">im using <a href="@page.linkToOtherPage"> but somehow it seems that this href gets overwritten.

    Please help!

    Thank you!

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Jun 07, 2016 @ 10:52
    Dirk De Grave
    0

    Nelson,

    Can you provide examples of current and expected output? And probably explain a bit more how things have been set up in cms?

    --Dirk

  • Nelson 94 posts 246 karma points
    Jun 13, 2016 @ 08:10
    Nelson
    0

    Hello Dirk,

    so whats happening is that I have a page with a set of items, each one of this items have a detailed page of their own. And this list page is the parent, and when I click in each item its suppose to redirect to the correspondent child page. But I want to add these items in other of my pages, and redirect them to those child pages, but i dont want to create new ones, so I was using Content Picker and then user href to redirect it to the page I select on content picker. However I noticed that the URL is not right, instead of having something like .../page1/item1, it has .../1572, so its like its not picking up right the page node I select on content picker. I worked with this a few weeks ago and everything was working fine till now. Do you have any idea about whats happening?
    I also noticed that when it comes to external links (http://www.google.com for example) it works fine, it just doesnt work with content picker.

    Thank you very much! I really need to fix this bug, but really dont know whats causing this.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Jun 13, 2016 @ 08:15
    Jan Skovgaard
    0

    Hi Nelson

    Can you provide the full source code for this?

    Seems like you're getting the id from the content picker and then you'll need to use a method for getting the url based on that id.

    But it's hard to advice you in your current context without being able to see the full code you're working on it would be nice if you could provide a full sample of it :)

    /Jan

  • Nelson 94 posts 246 karma points
    Jun 13, 2016 @ 08:24
    Nelson
    0

    Hello Jan,

    yes I just figured out that's exactly whats happening! Im getting the id from the content picker, how can I find out the url through the page id?

    Thank you very much! Very appreciated!

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Jun 13, 2016 @ 08:30
    Jan Skovgaard
    100

    Hi Nelson

    I would prefer seeing your full code but you should be able to get the full url from the id by using the NiceUrl() method, which you can see here https://our.umbraco.org/documentation/Reference/Querying/UmbracoHelper/

    So something like

    @post.NiceUrl(linkToOtherpage)
    

    Should to the trick.

    Hope this helps.

    /Jan

  • Nelson 94 posts 246 karma points
    Jun 13, 2016 @ 08:44
    Nelson
    0

    Thank you very much! That did the trick!

Please Sign in or register to post replies

Write your reply to:

Draft