11ty shortcode to output a menu

I’m trying to construct a 11ty universal shortcode that outputs a menu when passed a collection. (I’m not entirely sure this is the best may to output a menu.) So far I’ve tried:

config.addShortcode("navList", function( list ) { 
  var result = [];
  list.forEach(function(post, i) {
    result.push( '<li><a href="' + post.url + '">' + post.data.title + '</a></li>');

  return result.join('');

Which doesn’t seem to work quite right, as it gets me the url but not the title. (I’m also not entirely sure I’m constructing these the correct 11ty way.) Any help would be appreciated.


Aaaand it is right, there was a copy-and-paste error elsewhere.