Andy Wardley wrote:
Myk Melez wrote:
  
Thanks, that worked!  
    

Another approach is to use the new --template_module option for ttree.
  
Mmm, looks nifty.  I'll look into this.

You might also like to have a look at Template::Sitemap.
Hmm, very interesting.  I'll switch to this as soon as possible, which may not be until after it makes its way into CPAN, since I'm not the only one building my site (others check out from CVS and build locally, and getting them to install things not from CPAN is difficult).

In the meantime I'll try to synchronize my sitemap XML schema with the one Template-Sitemap is using to make the transition easier.  First, some thoughts...

If I understand correctly, Template-Sitemap autogenerates URLs based on the hierarchy in the sitemap file, but URLs can be overridden via a "url" attribute on page elements.  That's better than my code, which uses URLs as unique identifiers and thus requires all page elements to have "url" attributes identifying them.

Both approaches, however, require "url" attributes on all page elements whose locations in the sitemap hierarchy differ from their locations in the filesystem hierarchy, so moving pages around the sitemap without changing their corresponding files' filesystem locations (i.e. URLs) will always require adding "url" elements to the sitemap (or having them there to begin with), while moving files around the filesystem without changing their corresponding pages' sitemap locations isn't possible at all.

Seems like it would be better to use arbitrary unique IDs to match files to pages.  In other words, have files specify their ID ([% id = "foo" %]) and then use the ID to locate themselves in the sitemap ([% page = site.page( id => id ) %]).  This approach allows us to move pages in the sitemap without having to move their files in the filesystem and vice versa.  It also obviates the need to specify URLs/filesystem paths in the sitemap, since they aren't being used as IDs and can be derived from $template.name.

The downside to this approach is that pages have to specify their ID, but that cost could be mitigated by falling back to $template.name if an ID isn't explicitly specified.  If we do that, though, then <node:foo> syntax doesn't work, since element names can't contain slashes (AFAIK), so you'd have to go back to <node id="foo"> syntax.

Speaking of which, I read docs/design.txt, but it ends before explaining the transition from <page id="foo"> to <page:foo>, and the slides don't explain it either.  What's the motivation behind that?

-myk





Reply via email to