Copied to clipboard

Flag this post as spam?

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


  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    May 28, 2010 @ 10:12
    Jeroen Breuer
    0

    Write node to umbraco.config xml without publish

    Hello,

    Is it possible to write the data of a node to the umbraco.config xml without publishing the node?

    I've got a situation where I got news items which are displayed on a big overview page. This overview page is the parent node, but the child nodes (news items) don't have their own template and are only displayed in the parent node. Therefore I don't want to child nodes to be published because the url's would be useless. Currently I solved this by using the umbracoRedirect and all the news nodes are redirected to the parent. This works but I would prefer it if the url just wouldn't exit. 

    So I would like the node to be available in xml, but I don't want it to have an url. Is this possible or should I just keep using the umbracoRedirect?

    Jeroen

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    May 28, 2010 @ 10:15
    Sebastiaan Janssen
    0

    But, nobody sees the URL's, so what's the problem?

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    May 28, 2010 @ 10:16
    Jeroen Breuer
    0

    You're right about that but I just find it useless that there is an url in the first place if it's not used. Should be able to have the url disabled or something.

  • Aaron Powell 1708 posts 3046 karma points c-trib
    May 28, 2010 @ 10:17
    Aaron Powell
    0

    No, the Umbraco XML is the published cache.

    Unless you wanted something really ugly which captures the save event the generates XML and parses the document itself, but then you don't have the ability to have unpublished content.

    Why don't you just create a template which redirects to the parent node and set it as the default.

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    May 28, 2010 @ 10:20
    Jeroen Breuer
    1

    @slace I was also thinking about using a template which redirects to the parent. This saves me the trouble of having to set the umbracoRedirect on each news node. Is it better to make a 301 redirect in the template? Too bad there isn't some way to remove the url from a node.

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    May 28, 2010 @ 10:42
    Jeroen Breuer
    0

    I've added a codeplex future request: Remove the url from a node. http://umbraco.codeplex.com/WorkItem/View.aspx?WorkItemId=27213 Please vote.

  • RolandWolters 42 posts 63 karma points
    May 28, 2010 @ 10:46
    RolandWolters
    0

    I think it is the wrong appraoch to store info in the Umbraco database that you don't want to publish.

    I would create a custom datatype to use on the overviewpage to manage the news items. This cutsom datatype then stores the newsitems in a custom datatable in the database.

    On the frontend then, you can use a .net macro to pull the newsitems from the database.

  • Niels Hartvig 1951 posts 2391 karma points c-trib
    May 28, 2010 @ 10:48
    Niels Hartvig
    0
    Jeroen, I've closed the feature request as this isn't how Umbraco has been designed. In Umbraco all nodes have a url and that's by design.
  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    May 28, 2010 @ 10:53
    Jeroen Breuer
    0

    @RolandWolters That would work, but for something simple as news items it would be much better to use XSLT and you need the data to be stored in the umbraco.config xml for this. A .NET macro would also do the trick but XSLT is faster :). For more info about XSLT vs UserControl please visit http://our.umbraco.org/forum/developers/xslt/7571-Xslt-paging-vs-UserControl-gridview

    @Niels I can understand that's it's this way by design. I just hoped it could be changed. Guess I'll just have to go with the template which redirects to the parent. 

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    May 28, 2010 @ 11:28
    Sebastiaan Janssen
    0

    Jeroen, I do think, though, that this is a classic case of YAGNI. Nobody is ever going to know these URL's, so why develop functionality in case somebody ever hits the URL?

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    May 28, 2010 @ 11:39
    Jeroen Breuer
    0

    @Sebastiaan I'm no SEO expert, but isn't there a change the pages might be found in Google? If that's the case I would like them to redirect to correct page. Otherwise it sounds like YAGNI indeed :).

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    May 28, 2010 @ 12:05
    Sebastiaan Janssen
    1

    No, there is no chance, if you take care to exclude the newsarticle docType from your sitemap.xml and any HTML sitemaps or menu's on you site, then Google will not find the URL. Google only tries to index URLs based on something linking to it. Otherwise, how would the crawler know where to look? It's not going to guess, it's too busy for that! ;-)

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    May 28, 2010 @ 12:27
    Jeroen Breuer
    0

    @Sebastiaan Thank you for clearing that up for me :). Just like you said the newsarticle docType won't be in the sitemap.xml or any HTML sitemaps so it's unnessary to create any redirecting for these pages. I just won't give them a template. If by some miracle some still finds the pages they just get a blank page :).

  • Manthos 19 posts 35 karma points
    Nov 11, 2010 @ 10:08
    Manthos
    0

    Another thing you can try is to create in every news document a property named "umbracoUrlName" which is internally used by umbraco in order to form the url for each node. then set the value of this property for every document to the name of the parent node. you can set the value programmatically by registering the "before save" or "before publish" event. this way, all child documents (news) will have the same url as the parent document, without the need of the redirect functionality.

    For more information on how to create this special property have a look at:

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

    http://our.umbraco.org/forum/templating/templates-and-document-types/2825-Alter-node-url-from-name-to-id

     

    For more information on how to register umbraco events, have a look at:

    http://our.umbraco.org/wiki/reference/api-cheatsheet/using-applicationbase-to-register-events

    http://www.richardsoeteman.net/PermaLink,guid,f470b6cf-40da-4aa9-a0d9-7b984fe9bf59.aspx

     

    If you try this, be sure to use Document not Node:

    http://our.umbraco.org/wiki/reference/api-cheatsheet/difference-between-a-node-and-a-document

Please Sign in or register to post replies

Write your reply to:

Draft