whole_func_string: function getPages(files, metalsmith, done) {
    var metadata = metalsmith.metadata();
    
    var pages = [];
    var order = {};
    if (metadata.site.pages)
      metadata.site.pages.forEach((url, index) => typeof url == "string" ? order[url] = index : null);
    var unorderedPages = [];
    
    function addPage(url, title) {
      var page = {
        url: url,
        title: title
      };
      var index = order[url];
      if (index !== undefined)
        pages[index] = page;
      else
        unorderedPages.push(page);
    }
    
    for (var filename in files) {
      var file = files[filename];
      if (filename == "index.html")
        addPage("/", file.title||"Home Page");
      else if (file.permalink || file.navigation)
        addPage(file.permalink||filename, file.title||"Home Page");
    }
    
    unorderedPages.forEach(page => pages.push(page));
    metadata.site.pages = pages;
    
    done();
  }
func_code_string: function getPages(files, metalsmith, done) {
    var metadata = metalsmith.metadata();
    
    var pages = [];
    var order = {};
    if (metadata.site.pages)
      metadata.site.pages.forEach((url, index) => typeof url == "string" ? order[url] = index : null);
    var unorderedPages = [];
    
    function addPage(url, title) {
      var page = {
        url: url,
        title: title
      };
      var index = order[url];
      if (index !== undefined)
        pages[index] = page;
      else
        unorderedPages.push(page);
    }
    
    for (var filename in files) {
      var file = files[filename];
      if (filename == "index.html")
        addPage("/", file.title||"Home Page");
      else if (file.permalink || file.navigation)
        addPage(file.permalink||filename, file.title||"Home Page");
    }
    
    unorderedPages.forEach(page => pages.push(page));
    metadata.site.pages = pages;
    
    done();
  }
func_documentation_string: Metalsmith Plugin that collates a list of pages that are to be included in the site navigation
  into the metadata, along with their URLs.
  
  If the metadata has a `sites.pages`, then it is expected to be an array of URLs which indicates
  the ordering to be applied; `sites.pages` is replaced with an array of objects, one per page,
  that contains `url` and `title` properties.