Content Finders
Display global data in local web pages
Content Finders are an extremely powerful Umbraco feature that allows the serving of global data from a base page. Its only takes a few lines of code to connect these up.
For example, News Pages.
First you would create a Document Type that will be used as a local webpage for listing all news articles, maybe it display 10 news articles at a time in paged fashion, thats up to you. One of the properties on that Document Type is a News Article Global Data MultiNode TreePicker, this allows the content editor to select from which pool of News Articles they wish to display. For this example the Content Editor uses the Document Type and creates a page called 'News', which means the Url of that page is /news/. But in reality the Content Editor is free to call it whatever they like.
Next add code that Creates a ContentFinder, this code will run whenever a front end user requests an Url that doesn't currently match an existing Webpage. The idea is this ContentFinder will match Url requests that are valid and ignore any requests that aren't. In this example, if the end user tries to surf to '/news/latest-chocolate-news'
and one of the Global Data items that was picked by the Content Editor is named 'Latest Chocolate News', then we wish to show content from that Global Data Item using our Document Type.
Our job is to write code that takes '/news/latest-chocolate-news' and then tells Umbraco to send that request as if they had typed '/news/'
ContentFinders have Urls as their Input value and for Output allow you to say which existing Local Webpage Node you wish to handle that request. Then Umbraco will fire off the relevant Document Type Controller or Razor code applicable for that Document Type you select as Output.
- Create Content Finders to serve global data
Powering your content via Content Finders