4.12 History

Let's add the code to create history stack inside lib/menus.cws:

// History Stack

if (n_tokens == 1) 
{
  // This is the Home Page
  site.history = 'Home ';
} 
else 
{
  // An introductory page OR an internal page
  site.history = '<a href="' + linkadjust () + 'index.html">Home</a>: ';
  if (current_subsec == "index") 
  {
    // An introductory page 
    foreach (section [ ] in site.sections [ ]) 
    {
      if (section [0] == current_section) 
      {
    site.history += section [1]; 
      }
    }
  } 
  else 
  {
    // An internal page
    foreach (section [ ] in site.sections [ ]) 
    {
    if (section [0] == current_section) 
        {
          site.history += '<a href="' + linkadjust () + 
            current_section + '/index.html">' + section [1] 
        + '</a>: '; 
        }
    }
    foreach (subsec [ ] in subsections [ ]) 
    {
      if (subsec [0] == current_subsec) 
      {
        site.history += subsec [1];
      }
    }
  }
}

As usual, let's edit lib/template.cws and replace:

    <div class="light">
    History Stack
    </div>

with:

    <div class="light">
    @@ site.history @@
    </div>

Now, type make to update the site:

$ make
cows   index.cws index.html
cows   vegetarianism/suffering.cws vegetarianism/suffering.html
cows   vegetarianism/health.cws vegetarianism/health.html
cows   vegetarianism/hunger.cws vegetarianism/hunger.html
cows   vegetarianism/index.cws vegetarianism/index.html
cows   vegetarianism/act.cws vegetarianism/act.html

This manual can be downloaded from http://www.g-cows.org/.