Monday, November 08, 2010 at 12:05 AM.

system.verbs.builtins.radio.utilities.publishAllWeblogPages

<<11/16/01; 1:23:56 AM by JES
	<<This script publishes all of your weblog pages, all of your category pages, and all of your category archive pages. It also publishes your weblog and category rss files.
<<Changes
	<<11/17/01; 12:36:00 AM by JES
		<<Fixed a bug that Lawrence found which caused category archive pages not to be published properly.

if not dialog.confirm ("Publish all of your weblog and category pages?") {
	return (false)};
local (adrblog = radio.weblog.init ());
local (catsTable); new (tableType, @catsTable);
for i = 1 to sizeOf (adrblog^.categories) { //create a date-list for each category, set flDirty for each category
	local (adrcat = @adrblog^.categories[i]);
	local (catname = nameOf (adrcat^));
	catsTable.[catName] = {};
	adrcat^.flDirty = true};

local (datelist = {});
local (day, month, year, hour, minute, second);
local (adrpost);
for adrpost in @adrblog^.posts { //loop over posts, and determine which archive and category-archive days need to be published
	date.get (adrpost^.when, @day, @month, @year, @hour, @minute, @second);
	local (d = date.set (day, month, year, 0, 0, 0));
	if not (datelist contains d) {
		datelist = datelist + d};
	if defined (adrpost^.categories) {
		for i = 1 to sizeOf (adrpost^.categories) {
			if adrpost^.categories[i] {
				local (catname = nameOf (adrpost^.categories[i]));
				if defined (catsTable.[catname]) { //the category still exists
					catsTable.[catname] = catsTable.[catname] + d}}}}};

bundle { //publish the weblog home page
	radio.weblog.publish (adrblog)};
bundle { //publish the weblog RSS
	radio.weblog.publishRss (adrblog)};
bundle { //publish the weblog archive pages
	local (d);
	for d in datelist {
		radio.weblog.publish (adrblog, d:d)}};
bundle { //publish all of the category index pages
	for i = 1 to sizeOf (adrblog^.categories) {
		radio.weblog.publish (adrblog, nameOf (adrblog^.categories[i]))}};
bundle { //publish all of the category archive pages
	local (adrcatdates);
	for adrcatdates in @catsTable {
		local (catname = nameOf (adrcatdates^));
		local (d);
		for d in adrcatdates^ {
			radio.weblog.publish (adrblog, catname, d)}}};

dialog.notify ("Your weblog and category pages have been published.")



This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.