root/trunk/website/blog/googlesitemap.cfm

Revision 5, 2.3 kB (checked in by DanWilson, 17 years ago)

Initial Commit Of ModelGlue? Website (upgrade to blogcfc 511)

Line 
1<cfsetting enablecfoutputonly=true showdebugoutput=false>
2<cfprocessingdirective pageencoding="utf-8">
3<!---
4        Name         : Google Sitemap
5        Author       : Raymond Camden
6        Created      : Sometime in the past...
7        Last Updated : June 1, 2009
8        History      : November 30, 2006 (forgot to turn off enablecfoutput, thanks Hatem)
9        Purpose          : Blog Google Sitemaps feed.
10--->
11
12<cfset params = structNew()>
13<!--- Should be good for a while.... --->
14<cfset params.maxEntries = 99999>
15<cfset params.mode = "short">
16
17<cfset entries = application.blog.getEntries(params)>
18<cfset entries = entries.entries>
19<cfset pages = application.page.getPages()>
20
21<cfset z = getTimeZoneInfo()>
22<cfif not find("-", z.utcHourOffset)>
23        <cfset utcPrefix = "-">
24<cfelse>
25        <cfset z.utcHourOffset = right(z.utcHourOffset, len(z.utcHourOffset) -1 )>
26        <cfset utcPrefix = "+">
27</cfif>
28
29<cfif entries.recordcount>
30                <cfset dateStr = dateFormat(entries.posted[1],"yyyy-mm-dd")>
31                <cfset dateStr = dateStr & "T" & timeFormat(entries.posted[1],"HH:mm:ss") & utcPrefix & numberFormat(z.utcHourOffset,"00") & ":00">
32        <cfelse>
33                <cfset dateStr = dateFormat(now(),"yyyy-mm-dd") & "T" & timeFormat(now(),"HH:mm:ss") & utcPrefix & numberFormat(z.utcHourOffset,"00") & ":00">
34</cfif>
35
36
37
38<cfcontent type="text/xml" reset="true"><cfoutput><?xml version="1.0" encoding="UTF-8"?>
39<urlset xmlns="http://www.google.com/schemas/sitemap/0.84"
40        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
41        xsi:schemaLocation="http://www.google.com/schemas/sitemap/0.84
42        http://www.google.com/schemas/sitemap/0.84/sitemap.xsd">
43        <url>
44                <loc>#application.rootURL#/</loc>
45        <lastmod>#dateStr#</lastmod>
46                <changefreq>hourly</changefreq>
47                <priority>0.8</priority>
48        </url>
49        </cfoutput>
50        <cfoutput query="entries">
51                <cfset dateStr = dateFormat(posted,"yyyy-mm-dd")>
52                <cfset dateStr = dateStr & "T" & timeFormat(posted,"HH:mm:ss") & utcPrefix & numberFormat(z.utcHourOffset,"00") & ":00">
53                <url>
54                <loc>#xmlFormat(application.blog.makeLink(id))#</loc>
55                <lastmod>#dateStr#</lastmod>
56                </url>
57        </cfoutput>
58        <cfoutput query="pages">
59                <url>
60                <loc>#application.rootURL#/page.cfm/#alias#</loc>
61                <priority>0.5</priority>
62                <changefreq>weekly</changefreq>
63                <lastmod>#dateStr#</lastmod>
64        </url>
65        </cfoutput>
66<cfoutput>
67</urlset>
68</cfoutput>
69<cfsetting enablecfoutputonly=false showdebugoutput=false>
Note: See TracBrowser for help on using the browser.