Wildcard node to serve external database content for various URLs
Hi,
I'd like to know whether it's possible in Umbraco to create a node that will serve as a wildcard (in Sitecore CMS it's possible by adding node called "*" in a tree).
My aim is to store articles in an external database and serve them with URLs like http://somedomain.com/somearticlecategory/[given URL] - "given URL" part would contain info on external db element id and some kind of handler should render content for this element.
Is it achieveable with Umbraco? If not, are there any other ways to introduce external database in Umbraco?
Thanks, IContentFinder and INotFoundHandler seem to serve similar functionality, however I'm not sure about performance cost - do you know if it's resource greedy or I shouldn't mind?
To clear up - I plan to do it this way as we're about to have large database (around 100k+) of articles in our solution and I'm worried about performance issues if they were imported to Umbraco. My main concerns are the way Umbraco caches content (one huge XML file - it would be 500MB+ in this case) and publish times. I did tests with bulk content of 50k+ items and UI started to slow down as well as publishing took long time. Can you suggest another way of handling this many articles?
With that many items it's good to store them separately. Umbraco could become slow like you said. I never tried IContentFinder or INotFoundHandler so I don't know how good performance is. Maybe Stephan can help you with that.
@dnac: IContentFinder and INotFoundHandler look similar but starting with 4.10+ you want to use IContentFinder as that's most efficient. INotFoundHandler is there for backward compatibility only and will be obsoleted eventually.
Now as far as perfs are concerned... IContentFinder is called once per request to try and find a content to display. Performance only depends on how fast you manage to figure out what to display. Natively, Umbraco does it by looking into the XML cache. If you don't want to add your content in there, which would make sense if you don't plan to edit it through Umbraco, then you need to code your own "document store" (which would be readonly I guess) and code a way to map a url to a document in your store. Then... IContentFinder will use that way to resolve the url. Performance-wise, it only depends on how fast your code is.
What I'm trying to say I guess is that IContentFinder is as fast as the method it uses is. If you import your content into Umbraco then it's as fast as an XPath query over a fairly large XML document. No idea of exact perfs with your content -- I guess you should try it out. And if you keep your content in another store, say a DB with one row per article and the path to the article being kept in a field... then it would be as fast as one single SQL query, which could be quite fast.
Thanks Stephen and Jeroen, you helped me a lot, of course these suggestions make sense :) I'll check IContentFinder when I start this project - for now it's good to know that such option exists as I had real doubts if it will be achievable without huge coding effort.
Then you need an IContentFinder that detects that the url begins with "/our-documents/external" and probably tells Umbraco that it should display that document. Next you use the rest of the url to do a lookup in your store (database, I guess) ie you map "about-dogs-and-cats" to some content. You load that content and create a C# object of it, which you store in the request's context.
In the template used to display the document at "/our-documents/external" you retrieve the external content object from the request's context and display it as you need.
Wildcard node to serve external database content for various URLs
Hi,
I'd like to know whether it's possible in Umbraco to create a node that will serve as a wildcard (in Sitecore CMS it's possible by adding node called "*" in a tree).
My aim is to store articles in an external database and serve them with URLs like http://somedomain.com/somearticlecategory/[given URL] - "given URL" part would contain info on external db element id and some kind of handler should render content for this element.
Is it achieveable with Umbraco? If not, are there any other ways to introduce external database in Umbraco?
Cheers :)
Hello,
There isn't a wildcard node in Umbraco. These topics might help for an alternative:
http://www.theoutfield.net/blog/2013/10/handling-external-urls-in-umbraco-6
http://creativewebspecialist.co.uk/2013/08/07/the-new-way-to-do-a-404-umbraco-handler/
Jeroen
Thanks, IContentFinder and INotFoundHandler seem to serve similar functionality, however I'm not sure about performance cost - do you know if it's resource greedy or I shouldn't mind?
To clear up - I plan to do it this way as we're about to have large database (around 100k+) of articles in our solution and I'm worried about performance issues if they were imported to Umbraco. My main concerns are the way Umbraco caches content (one huge XML file - it would be 500MB+ in this case) and publish times. I did tests with bulk content of 50k+ items and UI started to slow down as well as publishing took long time. Can you suggest another way of handling this many articles?
With that many items it's good to store them separately. Umbraco could become slow like you said. I never tried IContentFinder or INotFoundHandler so I don't know how good performance is. Maybe Stephan can help you with that.
Jeroen
@dnac: IContentFinder and INotFoundHandler look similar but starting with 4.10+ you want to use IContentFinder as that's most efficient. INotFoundHandler is there for backward compatibility only and will be obsoleted eventually.
Now as far as perfs are concerned... IContentFinder is called once per request to try and find a content to display. Performance only depends on how fast you manage to figure out what to display. Natively, Umbraco does it by looking into the XML cache. If you don't want to add your content in there, which would make sense if you don't plan to edit it through Umbraco, then you need to code your own "document store" (which would be readonly I guess) and code a way to map a url to a document in your store. Then... IContentFinder will use that way to resolve the url. Performance-wise, it only depends on how fast your code is.
What I'm trying to say I guess is that IContentFinder is as fast as the method it uses is. If you import your content into Umbraco then it's as fast as an XPath query over a fairly large XML document. No idea of exact perfs with your content -- I guess you should try it out. And if you keep your content in another store, say a DB with one row per article and the path to the article being kept in a field... then it would be as fast as one single SQL query, which could be quite fast.
Making sense?
Stephan
Thanks Stephen and Jeroen, you helped me a lot, of course these suggestions make sense :) I'll check IContentFinder when I start this project - for now it's good to know that such option exists as I had real doubts if it will be achievable without huge coding effort.
Should not be a huge coding effort. Say you have your content below a catchall url, eg
/our-documents/external/about-dogs-and-cats
/our-documents/external/cooking-is-easy
...
Then you need an IContentFinder that detects that the url begins with "/our-documents/external" and probably tells Umbraco that it should display that document. Next you use the rest of the url to do a lookup in your store (database, I guess) ie you map "about-dogs-and-cats" to some content. You load that content and create a C# object of it, which you store in the request's context.
In the template used to display the document at "/our-documents/external" you retrieve the external content object from the request's context and display it as you need.
is working on a reply...