Copied to clipboard

Flag this post as spam?

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


  • Jacob Bach Pedersen 19 posts 73 karma points
    Feb 02, 2015 @ 14:43
    Jacob Bach Pedersen
    0

    Disable URL for some document types

    Hey

    I have a documenttype (Widgets) that should not have there own URL. Is it possible to disable URL for a documenttype?

    /Jacob

  • Rob Scott 41 posts 94 karma points
    Feb 02, 2015 @ 19:23
    Rob Scott
    0

    You don't assign a template to it and it won't have a page. Or, you can assign a custom property to the Doc Type (umbracoRedirect) and just redirect to a page.

    http://our.umbraco.org/wiki/reference/umbraco-best-practices/umbracoredirect

  • Aki 43 posts 213 karma points
    Aug 02, 2017 @ 07:42
    Aki
    0

    Ironically your link gives a 404

  • Jacob Bach Pedersen 19 posts 73 karma points
    Feb 05, 2015 @ 18:04
    Jacob Bach Pedersen
    0

    I don't think that the redirect is a perfect solution for me. I create a Root item in Content, called Widgets, where i placed all my wigets. So the widget right now gets a url like: /widget-name

    Right now i use the template on the widgets:

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage @{ Layout = null; }

    <div class="widget-box">
        <div class="title">@CurrentPage.title</div>
        <div class="bottom-text">@CurrentPage.text</div>
    </div>
    

    On my pages I using a Content Picker, to select the widgets and i do this:

    if (!string.IsNullOrEmpty(CurrentPage.rightWidgets))
    {
      var widgets = ((string)CurrentPage.rightWidgets).Split(new[] { ',' }).Select(int.Parse).ToList();
      foreach (var widget in widgets)
      {
        @Umbraco.RenderTemplate(widget)
        }
    }
    

    If I remove the template from the widget, how do i then Render the widget?

  • Tobias Klika 100 posts 567 karma points c-trib
    Feb 05, 2015 @ 23:19
    Tobias Klika
    0

    Problem with Umbraco is (at least I think so) that every node has it's own URL.
    If you don't assign a template the only thing that changes is that hitting the URL on the frontend will say "no template found ...".

    Redirect isn't a perfect solution either. Why? Because you reserve an URL that could be used somewhere else. And you do already give the URL an behavior it shouldn't have as it should be none-existing for the frontend user.

    You could return a 404 if the URL gets called directly (via your Controller).

    But I don't think there's an easy way to disable URL generation for a node, correct in case this is wrong ;-)

  • Imdad Ali 6 posts 77 karma points
    Jun 19, 2018 @ 13:42
    Imdad Ali
    1

    Anyone found a solution? ~ 3 years later.

Please Sign in or register to post replies

Write your reply to:

Draft