11ty / eleventy-navigation

A plugin for creating hierarchical navigation in Eleventy projects. Supports breadcrumbs too!
https://www.11ty.dev/docs/plugins/navigation/
99 stars 16 forks source link

Issues getting the example to run outside of this repo #16

Closed jonw-cogapp closed 4 years ago

jonw-cogapp commented 4 years ago

I've cloned and ran the sample in this repo, and it produces the results navigation just fine. However when I tried to implement the basic mammals example externally there is some kind of error preventing the navigation from being output. I've spent a while scratching my head on this and I just can't see where I'm going wrong. The collection and the navigation plugin both seem to be being picked up, but there is no output and the breadcrumb causes an error message.

The code I'm running: https://github.com/jonw-cogapp/11ty-navigation


Output from the log filter on collections.all

     Template {
       inputPath: './bats.md',
       inputDir: '.',
       parsed: [Object],
       extraOutputSubdirectory: '',
       outputDir: '_site',
       _extensionMap: [EleventyExtensionMap],
       linters: [],
       transforms: [],
       plugins: {},
       templateData: [TemplateData],
       paginationData: {},
       isVerbose: true,
       isDryRun: false,
       writeCount: 0,
       skippedCount: 0,
       wrapWithLayouts: true,
       fileSlug: [TemplateFileSlug],
       fileSlugStr: 'bats',
       filePathStem: '/bats',
       _templateRender: [TemplateRender],
       inputContent:
        '---\neleventyNavigation:\n  key: Bats\n  parent: Mammals\n---',
       _config: [Object],
       frontMatter: [Object],
       dataCache: [Object],
       computedData: [ComputedData] },
    inputPath: './bats.md',
    fileSlug: 'bats',
    filePathStem: '/bats',
    data:
     { pkg: [Object],
       eleventyNavigation: [Object],
       page: [Object],
       collections: [Object] },
    date: 2020-08-07T14:55:57.369Z,
    outputPath: '_site/bats/index.html',
    url: '/bats/',
    templateContent: [Getter/Setter] },
  { template:
     Template {
       inputPath: './humans.md',
       inputDir: '.',
       parsed: [Object],
       extraOutputSubdirectory: '',
       outputDir: '_site',
       _extensionMap: [EleventyExtensionMap],
       linters: [],
       transforms: [],
       plugins: {},
       templateData: [TemplateData],
       paginationData: {},
       isVerbose: true,
       isDryRun: false,
       writeCount: 0,
       skippedCount: 0,
       wrapWithLayouts: true,
       fileSlug: [TemplateFileSlug],
       fileSlugStr: 'humans',
       filePathStem: '/humans',
       _templateRender: [TemplateRender],
       inputContent:
        '---\neleventyNavigation:\n  key: Bats\n  parent: Mammals\n---',
       _config: [Object],
       frontMatter: [Object],
       dataCache: [Object],
       computedData: [ComputedData] },
    inputPath: './humans.md',
    fileSlug: 'humans',
    filePathStem: '/humans',
    data:
     { pkg: [Object],
       eleventyNavigation: [Object],
       page: [Object],
       collections: [Object] },
    date: 2020-08-07T14:56:01.087Z,
    outputPath: '_site/humans/index.html',
    url: '/humans/',
    templateContent: [Getter/Setter] },
  { template:
     Template {
       inputPath: './mammals.md',
       inputDir: '.',
       parsed: [Object],
       extraOutputSubdirectory: '',
       outputDir: '_site',
       _extensionMap: [EleventyExtensionMap],
       linters: [],
       transforms: [],
       plugins: {},
       templateData: [TemplateData],
       paginationData: {},
       isVerbose: true,
       isDryRun: false,
       writeCount: 0,
       skippedCount: 0,
       wrapWithLayouts: true,
       fileSlug: [TemplateFileSlug],
       fileSlugStr: 'mammals',
       filePathStem: '/mammals',
       _templateRender: [TemplateRender],
       inputContent:
        '---\neleventyNavigation:\n  key: Bats\n  parent: Mammals\n---',
       _config: [Object],
       frontMatter: [Object],
       dataCache: [Object],
       computedData: [ComputedData] },
    inputPath: './mammals.md',
    fileSlug: 'mammals',
    filePathStem: '/mammals',
    data:
     { pkg: [Object],
       eleventyNavigation: [Object],
       page: [Object],
       collections: [Object] },
    date: 2020-08-07T14:56:04.150Z,
    outputPath: '_site/mammals/index.html',
    url: '/mammals/',
    templateContent: [Getter/Setter] },
  { template:
     Template {
       inputPath: './index.njk',
       inputDir: '.',
       parsed: [Object],
       extraOutputSubdirectory: '',
       outputDir: '_site',
       _extensionMap: [EleventyExtensionMap],
       linters: [],
       transforms: [],
       plugins: {},
       templateData: [TemplateData],
       paginationData: {},
       isVerbose: true,
       isDryRun: false,
       writeCount: 0,
       skippedCount: 0,
       wrapWithLayouts: false,
       fileSlug: [TemplateFileSlug],
       fileSlugStr: '',
       filePathStem: '/index',
       _templateRender: [TemplateRender],
       inputContent:
        '<h2>Full List</h2>\n\n{{ collections.all | log }}\n{{ collections.all | eleventyNavigation | eleventyNavigationToHtml | safe }}\n\n<h2>Breadcrumb for Bats</h2>\n\n{{ collections.all | eleventyNavigationBreadcrumb("Bats") | eleventyNavigationToHtml | safe }}',
       _config: [Object],
       frontMatter: [Object],
       dataCache: [Object],
       computedData: [ComputedData] },
    inputPath: './index.njk',
    fileSlug: '',
    filePathStem: '/index',
    data: { pkg: [Object], page: [Object], collections: [Object] },
    date: 2020-08-07T14:57:41.747Z,
    outputPath: '_site/index.html',
    url: '/',
    templateContent: [Getter/Setter] } ]

Error message

> Having trouble rendering njk template ./index.njk

`TemplateContentRenderError` was thrown
> (./index.njk)
  Error: Node does not exist: Bats

`Template render error` was thrown:
    Template render error: (./index.njk)
      Error: Node does not exist: Bats
        at Object._prettifyError (/Users/jonwhite/Projects/11ty-navigation/node_modules/nunjucks/src/lib.js:36:11)
        at /Users/jonwhite/Projects/11ty-navigation/node_modules/nunjucks/src/environment.js:561:19
        at Template.root [as rootRenderFunc] (eval at _compile (/Users/jonwhite/Projects/11ty-navigation/node_modules/nunjucks/src/environment.js:631:18), <anonymous>:22:3)
        at Template.render (/Users/jonwhite/Projects/11ty-navigation/node_modules/nunjucks/src/environment.js:550:10)
        at /Users/jonwhite/Projects/11ty-navigation/node_modules/@11ty/eleventy/src/Engines/Nunjucks.js:236:14
        at new Promise (<anonymous>)
        at /Users/jonwhite/Projects/11ty-navigation/node_modules/@11ty/eleventy/src/Engines/Nunjucks.js:235:14
        at Template.render (/Users/jonwhite/Projects/11ty-navigation/node_modules/@11ty/eleventy/src/TemplateContent.js:199:28)

Debug output

  Eleventy:UserConfig Resetting EleventyConfig to initial values. +0ms
  Eleventy:Config Setting up global TemplateConfig. +0ms
  Eleventy:UserConfig Adding universal filter 'slug' +10ms
  Eleventy:UserConfig Adding universal filter 'url' +2ms
  Eleventy:UserConfig Adding universal filter 'log' +0ms
  Eleventy:UserConfig Adding universal filter 'getCollectionItem' +0ms
  Eleventy:UserConfig Adding universal filter 'getPreviousCollectionItem' +1ms
  Eleventy:UserConfig Adding universal filter 'getNextCollectionItem' +0ms
  Eleventy:TemplateConfig rootConfig { templateFormats: [ 'liquid', 'ejs', 'md', 'hbs', 'mustache', 'haml', 'pug', 'njk', 'html', 'jstl', '11ty.js' ], pathPrefix: '/', markdownTemplateEngine: 'liquid', htmlTemplateEngine: 'liquid', dataTemplateEngine: 'liquid', passthroughFileCopy: true, htmlOutputSuffix: '-o', jsDataFileSuffix: '.11tydata', keys: { package: 'pkg', layout: 'layout', permalink: 'permalink', permalinkRoot: 'permalinkBypassOutputDir', engineOverride: 'templateEngineOverride', computed: 'eleventyComputed' }, dir: { input: '.', includes: '_includes', data: '_data', output: '_site' }, filters: {}, handlebarsHelpers: {}, nunjucksFilters: {} } +0ms
  Eleventy:TemplateConfig Merging config with /Users/jonwhite/Projects/11ty-navigation/.eleventy.js +88ms
  Eleventy:UserConfig Adding plugin (unknown name: check your config file). +95ms
  Eleventy:TemplateConfig localConfig: { pathPrefix: '/sdljfkaldsjlfka/', templateFormats: undefined, filters: {}, linters: {}, layoutAliases: {}, passthroughCopies: {}, liquidOptions: {}, liquidTags: {}, liquidFilters: { slug: [Function], url: [Function], log: [Function], getCollectionItem: [Function], getPreviousCollectionItem: [Function], getNextCollectionItem: [Function] }, liquidShortcodes: {}, liquidPairedShortcodes: {}, nunjucksFilters: { slug: [Function], url: [Function], log: [Function], getCollectionItem: [Function], getPreviousCollectionItem: [Function], getNextCollectionItem: [Function], eleventyNavigation: [Function], eleventyNavigationBreadcrumb: [Function], eleventyNavigationToHtml: [Function] }, nunjucksAsyncFilters: {}, nunjucksTags: {}, nunjucksAsyncShortcodes: {}, nunjucksShortcodes: {}, nunjucksAsyncPairedShortcodes: {}, nunjucksPairedShortcodes: {}, handlebarsHelpers: { slug: [Function], url: [Function], log: [Function], getCollectionItem: [Function], getPreviousCollectionItem: [Function], getNextCollectionItem: [Function] }, handlebarsShortcodes: {}, handlebarsPairedShortcodes: {}, javascriptFunctions: { slug: [Function], url: [Function], log: [Function], getCollectionItem: [Function], getPreviousCollectionItem: [Function], getNextCollectionItem: [Function] }, pugOptions: {}, ejsOptions: {}, markdownHighlighter: null, libraryOverrides: {}, dynamicPermalinks: true, useGitIgnore: true, dataDeepMerge: false, watchJavaScriptDependencies: true, additionalWatchTargets: [], browserSyncConfig: {}, chokidarConfig: {}, watchThrottleWaitTime: 0, frontMatterParsingOptions: undefined, dataExtensions: Map {}, extensionMap: Set {}, quietMode: false, events: EventEmitter { _events: [Object: null prototype] {}, _eventsCount: 0, _maxListeners: undefined } } +11ms
  Eleventy:TemplateConfig overrides: {} +456ms
  Eleventy:TemplateConfig Current configuration: { templateFormats: [ 'liquid', 'ejs', 'md', 'hbs', 'mustache', 'haml', 'pug', 'njk', 'html', 'jstl', '11ty.js' ], pathPrefix: '/sdljfkaldsjlfka/', markdownTemplateEngine: 'liquid', htmlTemplateEngine: 'liquid', dataTemplateEngine: 'liquid', passthroughFileCopy: true, htmlOutputSuffix: '-o', jsDataFileSuffix: '.11tydata', keys: { package: 'pkg', layout: 'layout', permalink: 'permalink', permalinkRoot: 'permalinkBypassOutputDir', engineOverride: 'templateEngineOverride', computed: 'eleventyComputed' }, dir: { input: '.', includes: '_includes', data: '_data', output: '_site' }, filters: {}, handlebarsHelpers: { slug: [Function], url: [Function], log: [Function], getCollectionItem: [Function], getPreviousCollectionItem: [Function], getNextCollectionItem: [Function] }, nunjucksFilters: { slug: [Function], url: [Function], log: [Function], getCollectionItem: [Function], getPreviousCollectionItem: [Function], getNextCollectionItem: [Function], eleventyNavigation: [Function], eleventyNavigationBreadcrumb: [Function], eleventyNavigationToHtml: [Function] }, linters: {}, layoutAliases: {}, passthroughCopies: {}, liquidOptions: {}, liquidTags: {}, liquidFilters: { slug: [Function], url: [Function], log: [Function], getCollectionItem: [Function], getPreviousCollectionItem: [Function], getNextCollectionItem: [Function] }, liquidShortcodes: {}, liquidPairedShortcodes: {}, nunjucksAsyncFilters: {}, nunjucksTags: {}, nunjucksAsyncShortcodes: {}, nunjucksShortcodes: {}, nunjucksAsyncPairedShortcodes: {}, nunjucksPairedShortcodes: {}, handlebarsShortcodes: {}, handlebarsPairedShortcodes: {}, javascriptFunctions: { slug: [Function], url: [Function], log: [Function], getCollectionItem: [Function], getPreviousCollectionItem: [Function], getNextCollectionItem: [Function] }, pugOptions: {}, ejsOptions: {}, markdownHighlighter: null, libraryOverrides: {}, dynamicPermalinks: true, useGitIgnore: true, dataDeepMerge: false, watchJavaScriptDependencies: true, additionalWatchTargets: [], browserSyncConfig: {}, chokidarConfig: {}, watchThrottleWaitTime: 0, frontMatterParsingOptions: undefined, dataExtensions: Map {}, extensionMap: Set {}, quietMode: false, events: EventEmitter { _events: [Object: null prototype] {}, _eventsCount: 0, _maxListeners: undefined } } +3ms
  Eleventy:CommandCheck command: eleventy   +0ms
  Eleventy Eleventy warm up time (in ms) 1388.544114999997 +0ms
  Eleventy:TemplatePassthroughManager Resetting counts to 0 +0ms
  Eleventy:EleventyFiles /Users/jonwhite/Projects/11ty-navigation/.gitignore ignoring: !./node_modules/** +0ms
  Eleventy:EleventyFiles /Users/jonwhite/Projects/11ty-navigation/.gitignore ignoring: !./_site/** +0ms
  Eleventy Directories:
  Eleventy Input: .
  Eleventy Data: _data
  Eleventy Includes: _includes
  Eleventy Layouts: undefined
  Eleventy Output: _site
  Eleventy Template Formats: liquid,ejs,md,hbs,mustache,haml,pug,njk,html,jstl,11ty.js
  Eleventy Verbose Output: false +7ms
  Eleventy:EleventyFiles Searching for: [ './**/*.liquid', './**/*.ejs', './**/*.md', './**/*.hbs', './**/*.mustache', './**/*.haml', './**/*.pug', './**/*.njk', './**/*.html', './**/*.jstl', './**/*.11ty.js', './**/*.11ty.cjs', '!./node_modules/**', '!./_site/**', '!./_site/**', '!./_includes/**', '!./_data/**' ] +27ms
  Eleventy:TemplateWriter Found: [ './bats.md', './humans.md', './index.njk', './mammals.md' ] +0ms
  Eleventy:TemplatePassthroughManager TemplatePassthrough copy started. +198ms
  Eleventy:TemplatePassthroughManager `passthroughFileCopy` config paths: {} +1ms
  Eleventy:TemplatePassthroughManager `passthroughFileCopy` config normalized paths: [] +0ms
  Eleventy:TemplateData Using '.11tydata' to find data files. +0ms
  Eleventy:TemplateData getLocalDataPaths('./bats.md'): [ './bats.11tydata.js', './bats.11tydata.cjs', './bats.11tydata.json', './bats.json' ] +0ms
  Eleventy:TemplateData Using '.11tydata' to find data files. +1ms
  Eleventy:TemplateData getLocalDataPaths('./humans.md'): [ './humans.11tydata.js', './humans.11tydata.cjs', './humans.11tydata.json', './humans.json' ] +0ms
  Eleventy:TemplateData Using '.11tydata' to find data files. +17ms
  Eleventy:TemplateData getLocalDataPaths('./index.njk'): [ './index.11tydata.js', './index.11tydata.cjs', './index.11tydata.json', './index.json' ] +0ms
  Eleventy:TemplateData Using '.11tydata' to find data files. +1ms
  Eleventy:TemplateData getLocalDataPaths('./mammals.md'): [ './mammals.11tydata.js', './mammals.11tydata.cjs', './mammals.11tydata.json', './mammals.json' ] +0ms
  Eleventy:TemplatePassthroughManager TemplatePassthrough copy finished. Current count: 0 +22ms
  Eleventy:Template getMappedDate: using file created time for './bats.md' of 2020-08-07T14:55:57.369Z (from 1596812157369.0278) +0ms
  Eleventy:TemplateWriter ./bats.md added to map. +142ms
  Eleventy:Template getMappedDate: using file created time for './humans.md' of 2020-08-07T14:56:01.087Z (from 1596812161087.9565) +1ms
  Eleventy:TemplateWriter ./humans.md added to map. +0ms
  Eleventy:Template getMappedDate: using file created time for './index.njk' of 2020-08-07T14:57:41.747Z (from 1596812261747.322) +0ms
  Eleventy:TemplateWriter ./index.njk added to map. +0ms
  Eleventy:Template getMappedDate: using file created time for './mammals.md' of 2020-08-07T14:56:04.150Z (from 1596812164150.0222) +1ms
  Eleventy:TemplateWriter ./mammals.md added to map. +1ms
  Eleventy:TemplateMap Caching collections objects. +0ms
  Eleventy:Template First round of computed data for './bats.md' +62ms
  Eleventy:ComputedData 'page.url' accesses [] variables +0ms
  Eleventy:ComputedData 'page.outputPath' accesses [] variables +1ms
  Eleventy:ComputedData Computed data order of execution: [ 'page.url', 'page.outputPath' ] +1ms
  Eleventy:Template First round of computed data for './humans.md' +6ms
  Eleventy:ComputedData 'page.url' accesses [] variables +1ms
  Eleventy:ComputedData 'page.outputPath' accesses [] variables +0ms
  Eleventy:ComputedData Computed data order of execution: [ 'page.url', 'page.outputPath' ] +0ms
  Eleventy:Template First round of computed data for './index.njk' +1ms
  Eleventy:ComputedData 'page.url' accesses [] variables +1ms
  Eleventy:ComputedData 'page.outputPath' accesses [] variables +0ms
  Eleventy:ComputedData Computed data order of execution: [ 'page.url', 'page.outputPath' ] +26ms
  Eleventy:Template First round of computed data for './mammals.md' +26ms
  Eleventy:ComputedData 'page.url' accesses [] variables +1ms
  Eleventy:ComputedData 'page.outputPath' accesses [] variables +0ms
  Eleventy:ComputedData Computed data order of execution: [ 'page.url', 'page.outputPath' ] +0ms
  Eleventy:TemplateMap Collection: collections.all size: 4 +40ms
  Eleventy:TemplateMap Collection: collections.all size: 4 +1ms
  Eleventy:Template Second round of computed data for './bats.md' +4ms
  Eleventy:ComputedData Computed data order of execution: [] +3ms
  Eleventy:Template Second round of computed data for './humans.md' +0ms
  Eleventy:ComputedData Computed data order of execution: [] +0ms
  Eleventy:Template Second round of computed data for './index.njk' +0ms
  Eleventy:ComputedData Computed data order of execution: [] +0ms
  Eleventy:Template Second round of computed data for './mammals.md' +0ms
  Eleventy:ComputedData Computed data order of execution: [] +0ms
[ { template:
     Template {
       inputPath: './bats.md',
       inputDir: '.',
       parsed: [Object],
       extraOutputSubdirectory: '',
       outputDir: '_site',
       _extensionMap: [EleventyExtensionMap],
       linters: [],
       transforms: [],
       plugins: {},
       templateData: [TemplateData],
       paginationData: {},
       isVerbose: false,
       isDryRun: false,
       writeCount: 0,
       skippedCount: 0,
       wrapWithLayouts: true,
       fileSlug: [TemplateFileSlug],
       fileSlugStr: 'bats',
       filePathStem: '/bats',
       _templateRender: [TemplateRender],
       inputContent:
        '---\neleventyNavigation:\n  key: Bats\n  parent: Mammals\n---',
       _config: [Object],
       frontMatter: [Object],
       dataCache: [Object],
       computedData: [ComputedData] },
    inputPath: './bats.md',
    fileSlug: 'bats',
    filePathStem: '/bats',
    data:
     { pkg: [Object],
       eleventyNavigation: [Object],
       page: [Object],
       collections: [Object] },
    date: 2020-08-07T14:55:57.369Z,
    outputPath: '_site/bats/index.html',
    url: '/bats/',
    templateContent: [Getter/Setter],
    _templateContent: '' },
  { template:
     Template {
       inputPath: './humans.md',
       inputDir: '.',
       parsed: [Object],
       extraOutputSubdirectory: '',
       outputDir: '_site',
       _extensionMap: [EleventyExtensionMap],
       linters: [],
       transforms: [],
       plugins: {},
       templateData: [TemplateData],
       paginationData: {},
       isVerbose: false,
       isDryRun: false,
       writeCount: 0,
       skippedCount: 0,
       wrapWithLayouts: true,
       fileSlug: [TemplateFileSlug],
       fileSlugStr: 'humans',
       filePathStem: '/humans',
       _templateRender: [TemplateRender],
       inputContent:
        '---\neleventyNavigation:\n  key: Bats\n  parent: Mammals\n---',
       _config: [Object],
       frontMatter: [Object],
       dataCache: [Object],
       computedData: [ComputedData] },
    inputPath: './humans.md',
    fileSlug: 'humans',
    filePathStem: '/humans',
    data:
     { pkg: [Object],
       eleventyNavigation: [Object],
       page: [Object],
       collections: [Object] },
    date: 2020-08-07T14:56:01.087Z,
    outputPath: '_site/humans/index.html',
    url: '/humans/',
    templateContent: [Getter/Setter],
    _templateContent: '' },
  { template:
     Template {
       inputPath: './mammals.md',
       inputDir: '.',
       parsed: [Object],
       extraOutputSubdirectory: '',
       outputDir: '_site',
       _extensionMap: [EleventyExtensionMap],
       linters: [],
       transforms: [],
       plugins: {},
       templateData: [TemplateData],
       paginationData: {},
       isVerbose: false,
       isDryRun: false,
       writeCount: 0,
       skippedCount: 0,
       wrapWithLayouts: true,
       fileSlug: [TemplateFileSlug],
       fileSlugStr: 'mammals',
       filePathStem: '/mammals',
       _templateRender: [TemplateRender],
       inputContent:
        '---\neleventyNavigation:\n  key: Bats\n  parent: Mammals\n---',
       _config: [Object],
       frontMatter: [Object],
       dataCache: [Object],
       computedData: [ComputedData] },
    inputPath: './mammals.md',
    fileSlug: 'mammals',
    filePathStem: '/mammals',
    data:
     { pkg: [Object],
       eleventyNavigation: [Object],
       page: [Object],
       collections: [Object] },
    date: 2020-08-07T14:56:04.150Z,
    outputPath: '_site/mammals/index.html',
    url: '/mammals/',
    templateContent: [Getter/Setter] },
  { template:
     Template {
       inputPath: './index.njk',
       inputDir: '.',
       parsed: [Object],
       extraOutputSubdirectory: '',
       outputDir: '_site',
       _extensionMap: [EleventyExtensionMap],
       linters: [],
       transforms: [],
       plugins: {},
       templateData: [TemplateData],
       paginationData: {},
       isVerbose: false,
       isDryRun: false,
       writeCount: 0,
       skippedCount: 0,
       wrapWithLayouts: false,
       fileSlug: [TemplateFileSlug],
       fileSlugStr: '',
       filePathStem: '/index',
       _templateRender: [TemplateRender],
       inputContent:
        '<h2>Full List</h2>\n\n{{ collections.all | log }}\n{{ collections.all | eleventyNavigation | eleventyNavigationToHtml | safe }}\n\n<h2>Breadcrumb for Bats</h2>\n\n{{ collections.all | eleventyNavigationBreadcrumb("Bats") | eleventyNavigationToHtml | safe }}',
       _config: [Object],
       frontMatter: [Object],
       dataCache: [Object],
       computedData: [ComputedData] },
    inputPath: './index.njk',
    fileSlug: '',
    filePathStem: '/index',
    data: { pkg: [Object], page: [Object], collections: [Object] },
    date: 2020-08-07T14:57:41.747Z,
    outputPath: '_site/index.html',
    url: '/',
    templateContent: [Getter/Setter] } ]
  Eleventy:TemplateContent Having trouble rendering njk template ./index.njk: '<h2>Full List</h2>\n\n{{ collections.all | log }}\n{{ collections.all | eleventyNavigation | eleventyNavigationToHtml | safe }}\n\n<h2>Breadcrumb for Bats</h2>\n\n{{ collections.all | eleventyNavigationBreadcrumb("Bats") | eleventyNavigationToHtml | safe }}' +0ms
  Eleventy:EleventyErrorHandler Problem writing Eleventy templates: +0ms
  Eleventy:EleventyErrorHandler Having trouble rendering njk template ./index.njk
  Eleventy:EleventyErrorHandler 
  Eleventy:EleventyErrorHandler `TemplateContentRenderError` was thrown +0ms
  Eleventy:EleventyErrorHandler (error stack): TemplateContentRenderError: Having trouble rendering njk template ./index.njk
  Eleventy:EleventyErrorHandler     at Template.render (/Users/jonwhite/Projects/11ty-navigation/node_modules/@11ty/eleventy/src/TemplateContent.js:215:15)
  Eleventy:EleventyErrorHandler     at process._tickCallback (internal/process/next_tick.js:68:7) +0ms
  Eleventy:EleventyErrorHandler (./index.njk)
  Eleventy:EleventyErrorHandler   Error: Node does not exist: Bats
  Eleventy:EleventyErrorHandler 
  Eleventy:EleventyErrorHandler `Template render error` was thrown: +2ms
  Eleventy:EleventyErrorHandler (error stack): Template render error: (./index.njk)
  Eleventy:EleventyErrorHandler   Error: Node does not exist: Bats
  Eleventy:EleventyErrorHandler     at Object._prettifyError (/Users/jonwhite/Projects/11ty-navigation/node_modules/nunjucks/src/lib.js:36:11)
  Eleventy:EleventyErrorHandler     at /Users/jonwhite/Projects/11ty-navigation/node_modules/nunjucks/src/environment.js:561:19
  Eleventy:EleventyErrorHandler     at Template.root [as rootRenderFunc] (eval at _compile (/Users/jonwhite/Projects/11ty-navigation/node_modules/nunjucks/src/environment.js:631:18), <anonymous>:22:3)
  Eleventy:EleventyErrorHandler     at Template.render (/Users/jonwhite/Projects/11ty-navigation/node_modules/nunjucks/src/environment.js:550:10)
  Eleventy:EleventyErrorHandler     at /Users/jonwhite/Projects/11ty-navigation/node_modules/@11ty/eleventy/src/Engines/Nunjucks.js:236:14
  Eleventy:EleventyErrorHandler     at new Promise (<anonymous>)
  Eleventy:EleventyErrorHandler     at /Users/jonwhite/Projects/11ty-navigation/node_modules/@11ty/eleventy/src/Engines/Nunjucks.js:235:14
  Eleventy:EleventyErrorHandler     at Template.render (/Users/jonwhite/Projects/11ty-navigation/node_modules/@11ty/eleventy/src/TemplateContent.js:199:28) +0ms
  Eleventy:Benchmark Benchmark (Configuration): "log" Nunjucks Filter took 5ms (0.4%) +0ms
  Eleventy:Benchmark Benchmark (Configuration): "eleventyNavigationToHtml" Nunjucks Filter took 1ms (0.0%) +0ms
  Eleventy:Benchmark Benchmark (Aggregate): Searching the file system took 45ms (3.6%, called 2×, 22.4ms each) +0ms
  Eleventy:Benchmark Benchmark (Aggregate): Template Read took 50ms (4.0%, called 4×, 12.5ms each) +0ms
  Eleventy:Benchmark Benchmark (Aggregate): Template Compile took 26ms (2.1%, called 3×, 8.7ms each) +1ms
  Eleventy:Benchmark Benchmark (Aggregate): Template Render took 4ms (0.3%, called 3×, 1.2ms each) +0ms
Using pathPrefix: /sdljfkaldsjlfka/
Wrote 0 files in 0.50 seconds (v0.11.0)
  Eleventy Finished writing templates. +495ms
  Eleventy 
  Eleventy Getting frustrated? Have a suggestion/feature request/feedback?
  Eleventy I want to hear it! Open an issue: https://github.com/11ty/eleventy/issues/new +0ms

Start time: (2020-08-08 12:55:06 UTC) [treshold=1%]
 #  module                                                                       time  %
 1  fs-extra (node_modules/fs-extra/lib/index.js)                                55ms  ▇▇▇ 4%
 2  micromatch (node_modules/micromatch/index.js)                                18ms  ▇ 1%
 3  ./pattern (node_modules/fast-glob/out/utils/pattern.js)                      25ms  ▇▇ 2%
 4  ../utils (node_modules/fast-glob/out/utils/index.js)                         30ms  ▇▇ 2%
 5  ./managers/tasks (node_modules/fast-glob/out/managers/tasks.js)              31ms  ▇▇ 2%
 6  @nodelib/fs.walk (node_modules/@nodelib/fs.walk/out/index.js)                16ms  ▇ 1%
 7  ../readers/stream (node_modules/fast-glob/out/readers/stream.js)             21ms  ▇▇ 1%
 8  ./providers/async (node_modules/fast-glob/out/providers/async.js)            27ms  ▇▇ 2%
 9  fast-glob (node_modules/fast-glob/out/index.js)                              64ms  ▇▇▇▇ 4%
10  ./_castPath (node_modules/lodash/_castPath.js)                               18ms  ▇ 1%
11  ./_baseSet (node_modules/lodash/_baseSet.js)                                 29ms  ▇▇ 2%
12  lodash/set (node_modules/lodash/set.js)                                      30ms  ▇▇ 2%
13  ./_baseMergeDeep (node_modules/lodash/_baseMergeDeep.js)                     16ms  ▇ 1%
14  ./_baseMerge (node_modules/lodash/_baseMerge.js)                             24ms  ▇▇ 2%
15  lodash/merge (node_modules/lodash/merge.js)                                  31ms  ▇▇ 2%
16  semver (node_modules/semver/index.js)                                        29ms  ▇▇ 2%
17  ./UserConfig (node_modules/@11ty/eleventy/src/UserConfig.js)                 50ms  ▇▇▇ 3%
18  ./EleventyConfig (node_modules/@11ty/eleventy/src/EleventyConfig.js)         54ms  ▇▇▇ 4%
19  ./TemplateConfig (node_modules/@11ty/eleventy/src/TemplateConfig.js)         87ms  ▇▇▇▇▇ 6%
20  ./Config (node_modules/@11ty/eleventy/src/Config.js)                        656ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 43%
21  ./TemplateEngineManager (node_module...venty/src/TemplateEngineManager.js)  657ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 43%
22  ./EleventyExtensionMap (node_modules...eventy/src/EleventyExtensionMap.js)  658ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 43%
23  ./TemplateRender (node_modules/@11ty/eleventy/src/TemplateRender.js)        659ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 43%
24  ./TemplateData (node_modules/@11ty/eleventy/src/TemplateData.js)            823ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 54%
25  esprima (node_modules/esprima/dist/esprima.js)                               22ms  ▇▇ 1%
26  ../type/js/function (node_modules/js...ml/lib/js-yaml/type/js/function.js)   23ms  ▇▇ 2%
27  ./schema/default_full (node_modules/...lib/js-yaml/schema/default_full.js)   26ms  ▇▇ 2%
28  ./js-yaml/loader (node_modules/js-yaml/lib/js-yaml/loader.js)                45ms  ▇▇▇ 3%
29  ./lib/js-yaml.js (node_modules/js-yaml/lib/js-yaml.js)                       51ms  ▇▇▇ 3%
30  js-yaml (node_modules/js-yaml/index.js)                                      52ms  ▇▇▇ 3%
31  ./engines (node_modules/gray-matter/lib/engines.js)                          52ms  ▇▇▇ 3%
32  ./lib/defaults (node_modules/gray-matter/lib/defaults.js)                    55ms  ▇▇▇ 4%
33  gray-matter (node_modules/gray-matter/index.js)                              70ms  ▇▇▇▇ 5%
34  ./TemplateContent (node_modules/@11ty/eleventy/src/TemplateContent.js)       73ms  ▇▇▇▇ 5%
35  ./Template (node_modules/@11ty/eleventy/src/Template.js)                     91ms  ▇▇▇▇▇ 6%
36  globby (node_modules/globby/index.js)                                        20ms  ▇ 1%
37  del (node_modules/del/index.js)                                              29ms  ▇▇ 2%
38  ./lib/copy (node_modules/recursive-copy/lib/copy.js)                         44ms  ▇▇▇ 3%
39  recursive-copy (node_modules/recursive-copy/index.js)                        44ms  ▇▇▇ 3%
40  ./TemplatePassthrough (node_modules/...leventy/src/TemplatePassthrough.js)   45ms  ▇▇▇ 3%
41  ./TemplatePassthroughManager (node_m.../src/TemplatePassthroughManager.js)   46ms  ▇▇▇ 3%
42  ./EleventyFiles (node_modules/@11ty/eleventy/src/EleventyFiles.js)           47ms  ▇▇▇ 3%
43  ./TemplateWriter (node_modules/@11ty/eleventy/src/TemplateWriter.js)        153ms  ▇▇▇▇▇▇▇▇ 10%
44  ./src/Eleventy (node_modules/@11ty/eleventy/src/Eleventy.js)                993ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 65%
45  ./lib/ (node_modules/markdown-it/lib/index.js)                               52ms  ▇▇▇ 3%
46  markdown-it (node_modules/markdown-it/index.js)                              53ms  ▇▇▇ 3%
47  ./Engines/Markdown (node_modules/@11ty/eleventy/src/Engines/Markdown.js)     55ms  ▇▇▇ 4%
48  ./compiler (node_modules/nunjucks/src/compiler.js)                           16ms  ▇ 1%
49  ./src/environment (node_modules/nunjucks/src/environment.js)                 28ms  ▇▇ 2%
50  nunjucks (node_modules/nunjucks/index.js)                                    34ms  ▇▇ 2%
51  ./Engines/Nunjucks (node_modules/@11ty/eleventy/src/Engines/Nunjucks.js)     36ms  ▇▇ 2%
52  ./Engines/Liquid (node_modules/@11ty/eleventy/src/Engines/Liquid.js)         18ms  ▇ 1%
Total require(): 1206
Total time: 1.5s
ws-mitch commented 4 years ago

I've been trying to get breadcrumb navigation to work as well, and have been running into the same issue. I tried doing some debugging on my own, and have come to the conclusion that the pages getting passed into the findDependencies function are always empty.

After some cursory print debugging, it looks like the findDependencies function is being called before findNavigationEntries resolves. Here's what my logs look like: Nodes passed to findDeps: [] Nodes passed to findDeps: [] Nodes passed to findDeps: [] Nodes passed to findDeps: [] Nodes passed to findDeps: [] Nodes passed to findDeps: [] Nodes passed to findDeps: [] Nodes passed to findDeps: [] Nodes passed to findDeps: [] Nodes passed to findDeps: [] Nodes passed to findDeps: [] Entry to pages: { key: 'COVID-19', parent: 'main', order: 1, url: '/', pluginType: 'eleventy-navigation', parentKey: 'main', title: 'COVID-19', children: [] } Entry to pages: { key: 'Fall Plans', parent: 'main', order: 2, url: '/plans/', pluginType: 'eleventy-navigation', parentKey: 'main', title: 'Fall Plans', children: [] } Entry to pages: { key: 'FAQ', parent: 'main', order: 3, url: '/faq/', pluginType: 'eleventy-navigation', parentKey: 'main', title: 'FAQ', children: [] } ...

And the relevant console logs in the code: function findNavigationEntries(nodes = [], key = "") { ... return pages.sort(function(a, b) { return (a.order || 0) - (b.order || 0); }).map(function(entry) { if(!entry.title) { entry.title = entry.key; } if(entry.key) { entry.children = findNavigationEntries(nodes, entry.key); } console.log("Entry to pages: ", entry); return entry; }); }

function getDependencyGraph(nodes) { let pages = findNavigationEntries(nodes); let graph = new DepGraph(); console.log("Nodes passed to findDeps: ", pages); findDependencies(pages, graph); return graph; }

jonw-cogapp commented 4 years ago

Edit: sorry, I misread your comment. Does this work for you on the standard nav output?

I did a bit more digging yesterday and it seems that it's eleventyNavigation (findNavigationEntries) that's taking a full collection and always returning an empty array. I didn't get much further than that though

ws-mitch commented 4 years ago

@jonw-cogapp Yes, the standard nav output runs just fine for me.

jonw-cogapp commented 4 years ago

I'm closing this issue - I'd accidentally botched the keys in the example I'd linked and this was the root cause of this issue. We've had a heatwave here so I'm blaming that 😅

When I realised this and looked at my real project code there was another reason; the indentation was using a tab instead of spaces (which is weird because I don't use tabs). That was what prevented it from picking up the keys there.