WebGUI
      Click here to register.
      
YAPC North America 2008

Google Sitemap Config XML

User: zxp
Date: 8/7/2006 11:27 pm
Views: 3356
Rating: -13    Rate [
|
]

When import this package into your asset tree, you can visit http://www.example.com/config.xml to get the google sitemap config.xml file, then you can use the tool from google to generate the sitemap.xml.gz for google sitemap. 

The command is:
#wget http://www.example.com/config.xml
#sitemap_gen.py --config=config.xml

You mast change the <site base_url="http://www.example.com" ... > and <url href="http://www.example.com ...> to fit your site need.

Chinese user can see here for details:
中文用户查看这里了解详细步骤:
http://www.webgui.cn/webgui/applications/app-list/webgui-google-sitemap 



Replies

Re: Google Sitemap Config XML
User: Jesse
Date: 1/11/2007 11:34 pm
Rating: 2    Rate [
|
]
Status: Approved

Great to see someone took my sitemap stuff a step further and made a package out of it!

Not sure if this got my latest tweaks, but I figured out how to do the timestamp properly for the config.xml - all it requires is a one line change to get it to do timestamps for each url.

in the <tmpl_loop pageloop>

change the url bit to:

<url href="http://www.example.com<tmpl_var page.url>" lastmod="^LastModifiedPage(<tmpl_var page.url>,,%y-%m-%dT%h:%n:%s+00:00);" />

You'll need to replace +00:00 above with your local timezone settings based on GMT.  So if you're in Perth you might add +08:00 while if you're in the US you might add -08:00.

I've included an updated google sitemap package based on zxp's work with the change above.

Jesse 

-
If my comment is useful, rate me - I can always use the karma! :)
Join us on the #webgui irc channel on freenode! (I use the nick Radix)


Re: Google Sitemap Config XML
User: elnino
Date: 1/11/2008 2:56 pm
Rating: 6    Rate [
|
]
Status: Approved

where is this LastModifiedPage macro coming from? I didn't see it described on the wiki either. do I need to install the package to get it?

 

Thanks!

 


Re: Google Sitemap Config XML
User: Jesse
Date: 2/26/2008 3:57 pm
Rating: 3    Rate [
|
]
Status: Approved

package WebGUI::Macro::LastModifiedPage;

#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2006 Plain Black Corporation.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using
# this software.
#-------------------------------------------------------------------
# http://www.plainblack.com                     info@plainblack.com
#-------------------------------------------------------------------

use strict;
use WebGUI::Asset;
use WebGUI::International;

=head1 NAME

Package WebGUI::Macro::LastModifiedPage

=head1 DESCRIPTION

Macro for displaying the date that the most recent revision of the given Asset was last modified.

=head2 process ( [asset, label, format] )

=head3 asset

Asset to calculate the date from.

=head3 label

Text to prepend to the date.  This can be the empty string.

=head3 format string

A string specifying how to format the date using codes similar to those used by
sprintf.  See L<WebGUI::Session::datetime/"epochToHuman"> for a list of codes.
Uses "%z" if empty.

=cut


#-------------------------------------------------------------------
sub process {
        my $session = shift;
        return '' unless $session->asset;
        my ($asseturl, $label, $format, $time);
        ($asseturl, $label, $format) = @_;
        $format = '%z' if ($format eq "");
        my $asset = WebGUI::Asset->newByUrl($session,$asseturl);
        ($time) = $session->dbSlave->quickArray("SELECT max(revisionDate) FROM assetData where assetId=?",[$asset->getId]);
        if ($time) {
                return $label.$session->datetime->epochToHuman($time,$format);
        }
        my $i18n = WebGUI::International->new($session,'Macro_LastModified');
        return $i18n->get('never');
}

1;

-
If my comment is useful, rate me - I can always use the karma! :)
Join us on the #webgui irc channel on freenode! (I use the nick Radix)


Re: Google Sitemap Config XML
User: dionak
Date: 3/31/2008 1:53 pm
Rating: 3    Rate [
|
]
Status: Approved

Is it just me, or is this package now corrupt? 

Diona 

----
Knowmad Technologies
http://www.knowmad.com