Site maps are useful to show people your entire site at a glance so they can more easily find what they are looking for. Another added bonus of a site map is it helps search engines spider your site. Here is the code.
Start by creating a new page called Sitemap.cfm or whatever you want to call it. Place the above code on it. What this will give you is your entire web site laid out in a hierarchical format with the last date the page was updated. Lets walk through the code quickly. Most of it should look familiar, because it is a very stripped down version of the side menu. This one includes all of the parents and children. The query is performed on all the active records and CFOUTPUT on line 7. I am using the same CFLOOP to put the dashes before the links. Lines 11 through 13 put the page links and the revision date on the page. That is it. Very simple because you have already done all the work on the add a new page action (populated the hierarchy variable).
We have walked through the creation of a simple but powerful content management system. We have leveraged the power of building the pages with a hierarchical structure which allows us to dynamically build out a breadcrumb list, a side menu and also a site map page. This was done to minimize the amount of time it takes to maintain and update a web site. This was not meant to be an extensive build out of a content management system, but to provide you with the core of what is needed. In order to put this on a public server, you still have to provide a way to authenticate the administrator so that you can lock all of the administrative functions from the public.
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |