PROVIDING THE LATEST NEWS, EVENTS, AND POSTS

One recurring requirement when you are building custom websites is to provide the ability to autogenerate lists of pages or particular items (outside of standard navigation). For example, most corporate websites have something like Latest News, Upcoming Events, and so on. Obviously, it would be great if you didn't have to manually create those lists and standard content. If you did them manually, you would have to update the content in several places every time you added a news article or event to the site. Enter macros and document types (again). Building on previous examples in Chapter 5 and the use of Runway, Listing 9-4 outputs a listing of FAQs entered in your Runway website.

image The XSLT template in Listing 9-4 is originally based on the List Subpages by Document Type template that you can find in the Create new XSLT dialog (covered in Chapter 5).

LISTING 9-4: ListFaqs.xslt

image
<?xml version=“1.0” encoding=“UTF-8”?> <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp “&#x00A0;”> ]> <xsl:stylesheet version=“1.0” xmlns:xsl=“http://www.w3.org/1999/XSL/Transform” xmlns:msxml=“urn:schemas-microsoft-com:xslt” xmlns:umbraco.library=“urn:umbraco.library” xmlns:Exslt.ExsltCommon=“urn:Exslt.ExsltCommon” xmlns:Exslt.ExsltDatesAndTimes=“urn:Exslt.ExsltDatesAndTimes” ...

Get Umbraco User's Guide now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.