<webmake>

<metadefault name="Title" value="Story 1, blah blah" />
<metadefault name="Score" value="20" />
<metadefault name="Abstract" value="Story 1, just another story." />
<metadefault name="Section" value="Business" />
<content name="story_1.txt" format="text/et">
This is story 1.
</content>

<metadefault name="Title" value="Story 2, blah blah">
<metadefault name="Score" value="20">
<metadefault name="Abstract" value="Story 2, just another story.">
<metadefault name="Section" value="Technology">
<content name="story_2.txt" format="text/et">
This is story 2.
</content>
</metadefault>
</metadefault>
</metadefault>
</metadefault>

<metadefault name="Title" value="Hot! story 3, etc etc." />
<metadefault name="Score" value="10" />
<metadefault name="Abstract" value="Story 3, the highest-scored story." />
<metadefault name="Section" value="Technology" />
<content name="story_3.txt" format="text/et">
Breaking news! this is story 3.
</content>

<metadefault name="Score" />
<metadefault name="Section" />
<metadefault name="Abstract" />
<metadefault name="Title" />


<{perlpostdecl
        # create a ${all_stories} variable containing the list
        # of all text files just loaded.
        $_ = '';
        foreach my $pg (sorted_content_matching ("score title", "*.txt"))
	{
          $pg =~ s/\.txt$//; $_ .= "$pg ";
        }
        set_content ("all_stories", $_);
        '';
}>

<{!-- ------------------------------------------------------------------- --}>

<content name=header map=false>
  <html><head>
    <title>$[this.title]</title>
    <meta name="Abstract" value="$[this.abstract]" />
  </head>
  <body bgcolor=#ffffff>
  <h1>WebMake Sitemap Demo</h1>
  <hr />
  <a href=$(mainindex)>Index</a> | 
  <a href=$(map)>Site Map</a> | 
  <a href=$(fullmap)>Full Site Map</a>
  <hr />
</content>

<content name=footer map=false>
  <hr /><p>
  <em>Sorry about the crappy formatting BTW, this is just a demo. ;)</em>
  </p>
  </body>
  </html>
</content>

<{!-- ------------------------------------------------------------------- --}>

<content name=index_list_item map=false>
  <li>
    <a href=$(${item})>$[${item}.txt.title]</a><br />
    <p>$[${item}.txt.abstract]</p>
  </li>
</content>

<metadefault name=title value="WebMake Sample: a news site" />
<metadefault name=abstract value="some old news site" />
<content name=index_chunk isroot=true>
  <ul>
  <{perl
    make_list ('index_list_item', get_list ("all_stories"));
  }>
  </ul>
</content>

<{!-- ------------------------------------------------------------------- --}>

<for name=pg values="${all_stories}">
  <out name="${pg}" file="log/metadefault_${pg}.html">
    ${header}${${pg}.txt}${footer}
  </out>
</for>

<out name=mainindex file=log/metadefault.html>
  ${header}${index_chunk}${footer}
</out>

<{!-- ------------------------------------------------------------------- --}>


<content name=sitemapnode map=false>
  <li>
    <p>
      <a href=$(url)>${title}</a>: $[${name}.abstract]<br>
      <em>[score: ${score}, name: ${name}, is_node: ${is_node}]</em>
      <{!-- don't forget to list the sub-items --}>
      <ul> ${list} </ul>
    </p>
  </li>
</content>

<content name=sitemapleaf map=false>
  <li>
    <p>
      <a href=$(url)>${title}</a>: $[${name}.abstract]<br>
      <em>[score: ${score}, name: ${name}, is_node: ${is_node}]</em>
      <{!-- no sub-items here --}>
    </p>
  </li>
</content>

<content name=sitemapdynamic map=false>
  <li>
    <em>[${name} = "$[${name}]"]</em>
  </li>
</content>

<metadefault name=title value="WebMake Sample: site map">
<metadefault name=Abstract value="Map of the site">
<out name=map file=log/metadefault_map.html>
  ${header}${mainsitemap}${footer}
</out>
</metadefault>
</metadefault>

<sitemap name=mainsitemap node=sitemapnode leaf=sitemapleaf />

<metadefault name=title value="WebMake Sample: full site map" />
<metadefault name=Abstract value="Full map of the site" />
<out name=fullmap file=log/metadefault_fullmap.html>
  ${header}${fullsitemap}${footer}
</out>

<sitemap name=fullsitemap rootname=index_chunk all=true
	node=sitemapnode leaf=sitemapleaf dynamic=sitemapdynamic />

</webmake>

