<webmake>

<include file="data/test_stories.inc" />

<{perl
        # 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", $_);
        '';
}>

<!-- also add some media items that should not be included in the sitemap -->
<media src="data/contentsfind.data" name=".../*.txt" />

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

<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>
  <hr />
</content>

<content name=footer map=false> <hr /> </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>

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

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


<content name=sitemapnode map=false>
  <li>
    <p>
      <a href=$(url)>${title}</a>: $[${name}.abstract]<br>
      <ul> ${list} </ul>
    </p>
  </li>
</content>

<content name=sitemapleaf map=false>
  <li>
      <a href=$(url)>${title}</a>: $[${name}.abstract]<br>
  </li>
</content>

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

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

<!-- ----------------------------------------------------------------- -->

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

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

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

</webmake>

