USING DOCUMENT TYPE PROPERTIES

Umbraco has a number of properties that are standard to all installations. You can reference these properties much like you do with your own custom properties in XSLT and .NET macros as well as in any templates. You can find examples of how to use these properties, along with your own custom ones, in Chapters 4 and 5.

Built-in Properties

The following properties are available for any given node in the Umbraco XML cache and .NET Node object. Table 3-6 provides a detailed description of each property. For examples on how to use the .NET Node object, see Chapter 12.

TABLE 3-6: Built-in Properties

PROPERTY NAME DESCRIPTION
id The unique sequential autogenerated node ID.
parentId The ID of the parent node.
level The level at which this node is currently on. Note here that the first level is the root, which is eff ectively 0. So, in the Runway installation, as used in Chapter 1, the Runway Homepage is at level 1.
nodeType The ID of the document type that the current node is created from.
template The ID of the template that the node is currently using.
sortOrder The order of the node within the current parent. sortOrder restarts with each parent level.
urlName The name of the page in URL-friendly format. For example, the Runway Homepage has a urlName of runway-homepage. The urlName does not have the full path or an extension on it. This is all compiled based on the path property and is done at runtime.
nodeName The name of the node as it was created — for example, Runway Homepage. This property aff ects the urlName, so if this is changed, the URL of the page is updated as well.
creatorId The ID of the user who created the node.
creatorName The given name associated with the user account that created the node.
writerId The ID of the person who last edited the node.
writerName The given name associated with the user account that last edited the node.
createDate The date and time stamp when the node was created.
updateDate The date and time stamp when the node was last updated.
path A comma-delimited list of the hierarchical path of the node as it relates to the root node. For example, the Runway Homepage has a path of -1,1048.

image The root node in the content tree always has an ID of -1.

Properties with Special Meaning

In addition to these built-in properties, Umbraco also has some properties with special features. This means that Umbraco will react to the values of these properties automatically when they exist on a given document type. Table 3-7 provides details on what all of these do.

TABLE 3-7: Umbraco Special Properties

PROPERTY NAME DESCRIPTION
umbracoRedirect Add this property to your document type, with a data type of Content Picker, if you want to have an editor select an internal page to redirect the end user to.
umbracoInternalRedirectId This has the same end result as umbracoRedirect, except in this case Umbraco will load the content of the selected internal page transparently without redirecting to the new URL. Choose Content Picker as the data type, allowing the editor to select the target page using the content tree.
umbracoUrlName This property allows you to alter the urlName of the page without changing the nodeName. For example, if you created a page with the title This Is A Test Page, the resulting url-Name would be this-is-a-test-page.aspx. With this property, you can change the URL to test-page.aspx instead. Note, don't add a trailing .aspx to this property because it is added automatically if you have not set your installation to umbracoUseDirectoryUrls=true, as discussed in Chapter 1.
umbracoUrlAlias Add this property to your document type if you need multiple URLs to match a single node. For example, if you add test-home, test/home on the Runway Homepage node, the following URLs would be valid:
http://yoursiteurl.com/
http://yoursiteurl.com/test-home.aspx
http://yoursiteurl.com/test/home.aspx
This is particularly useful for marketing URLs and other tracking mechanisms. Keep in mind here that from a search engine optimization standpoint, having multiple URLs pointing to the same content reduces your score with many popular search engines such as Google and Yahoo.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset