xowiki::Package proc google_sitemapindex (public)

 xowiki::Package[i] google_sitemapindex [ -changefreq changefreq ] \
    [ -priority priority ] [ -package package ]

Defined in /var/www/openacs.org/packages/xowiki/tcl/package-procs.tcl

This method provides a sitemap index of all xowiki instances in google site map format https://www.google.com/webmasters/sitemaps/docs/en/protocol.html

Switches:
-changefreq (optional, defaults to "daily")
changefreq as defined by google
-priority (optional, defaults to "priority")
priority as defined by google
-package (optional, object)
to determine the delivery instance

Testcases:
No testcase defined.
Source code:
set content {<?xml version="1.0" encoding="UTF-8"?>
  <sitemapindex xmlns="http://www.google.com/schemas/sitemap/0.84">
}
foreach package_id [::xowiki::Package instances] {
  if {![parameter::get -package_id $package_id  -parameter include_in_google_sitemap_index  -default 1]} {
    continue
  }
  set last_modified [::xo::dc get_value get_newest_modification_date  {select max(last_modified)
                           from acs_objects
                           where package_id = :package_id
                         }]

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

  #:log "--site_node::get_from_object_id -object_id $package_id"
  array set info [site_node::get_from_object_id -object_id $package_id]

  append content <sitemap> \n <loc>[ad_url]$info(url)sitemap.xml</loc> \n <lastmod>$time</lastmod> \n </sitemap>
}
append content </sitemapindex> \n
if {[info exists package]} {
  #
  # Since we are running here in a proc, and we were called via
  # "reply_to_user", we have to provide the proper mime_type to the
  # calling package instance for delivery
  #
  $package set mime_type text/xml
  return $content
} else {
  #
  # In case, someone called us differently
  #
  ns_return 200 text/xml $content
  ad_script_abort
}
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: