xowiki::Package instproc www-google-sitemap (public)

 <instance of xowiki::Package[i]> www-google-sitemap \
    [ -max_entries max_entries ] [ -changefreq changefreq ] \
    [ -priority priority ]

Defined in packages/xowiki/tcl/package-procs.tcl

This web-callable method reports the content of xowiki folder in google site map format https://www.google.com/webmasters/sitemaps/docs/en/protocol.html

Switches:
-max_entries
(optional)
maximum number of entries retrieved
-changefreq
(defaults to "daily") (optional)
changefreq as defined by google
-priority
(defaults to "0.5") (optional)
priority as defined by google

Partial Call Graph (max 5 caller/called nodes):
%3 xo::db::tcl_date xo::db::tcl_date (public) xowiki::url xowiki::url (private) xowiki::Package instproc www-google-sitemap xowiki::Package instproc www-google-sitemap xowiki::Package instproc www-google-sitemap->xo::db::tcl_date xowiki::Package instproc www-google-sitemap->xowiki::url

Testcases:
No testcase defined.
Source code:
set package ::${:id}
set folder_id [$package folder_id]

set timerange_clause ""

set content {<?xml version="1.0" encoding="UTF-8"?>
  <urlset xmlns="http://www.google.com/schemas/sitemap/0.84"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.google.com/schemas/sitemap/0.84
http://www.google.com/schemas/sitemap/0.84/sitemap.xsd">
}

set sql [::xo::dc select  -vars "ci.parent_id, s.body, p.name, p.creator, p.title, p.page_id, p.object_type as content_type, p.last_modified, p.description"  -from "xowiki_pagex p, syndication s, cr_items ci"  -where "ci.parent_id = :folder_id and ci.live_revision = s.object_id  and s.object_id = p.page_id $timerange_clause"  -orderby "p.last_modified desc"  -limit $max_entries]
# :log $sql

::xo::dc foreach get_pages $sql {
  #:log "--found $name"
  if {[string match "::*" $name]} continue
  if {$content_type eq "::xowiki::PageTemplate::"} continue

  set time [::xo::db::tcl_date $last_modified tz]
  set time "[clock format [clock scan $time] -format {%Y-%m-%dT%T}]${tz}:00"

  append content <url> \n <loc>[$package pretty_link -absolute true -parent_id $parent_id $name]</loc> \n <lastmod>$time</lastmod> \n <changefreq>$changefreq</changefreq> \n <priority>$priority</priority> \n </url> \n
}

append content </urlset> \n

set :mime_type text/xml
return $content
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: