Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The "path" argument must be of type string. Received type boolean (false) #2806

Open
ryangittings opened this issue Feb 13, 2023 · 3 comments

Comments

@ryangittings
Copy link

ryangittings commented Feb 13, 2023

Operating system

macOS Ventura 13.0

Eleventy

2.0.0

Describe the bug

Original error stack trace: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type boolean (false)

at Template._write (/node_modules/@11ty/eleventy/src/Template.js:751:34)

Reproduction steps

  1. Use JS frontmatter as follows
---js
{
  layout: "layouts/default.njk",
  pagination: {
    alias: "spage",
    data: "pages",
    size: 1,
    addAllPagesToCollections: true,
  },
  eleventyComputed: {
    title: (data) => data.spage.title,
    eleventyNavigation: {
      key: (data) => {
        if (data.spage.navigation) {
          return data.spage.navigation.key;
        }

        return null;
      },
      parent: (data) => {
        if (data.spage.navigation && data.spage.navigation.parent) {
          return data.spage.navigation.parent.navigation.key;
        }

        return null;
      }
    },
    permalink: (data) => {
      if (data.spage.slug) {
        return `${data.spage.slug.current}index.html`;
      }
      
      return false;
    }
  }
}
---
  1. Run build
  2. Error

Expected behavior

To build pages that have a slug, and to ignore ones with a false permalink

Reproduction URL

No response

Screenshots

No response

@zachleat
Copy link
Member

is this still relevant or was it fixed with #2853

@ryangittings
Copy link
Author

I believe this is still an issue. But I've worked around it. I think it happens when JS is used in the front matter for a permalink.

@eaton
Copy link

eaton commented Dec 7, 2023

I'm running into this with Eleventy 2.0.1 with no serverless functionality in play: using pagination to iterate over an array in the global data, then a 'permalink' function in eleventyComputed.js, everything works fine unless I return FALSE to suppress output for one of the items.

Happy to whip up a bite-sized script to duplicate it if it helps, but it does seem to mirror just what this issue describes. Curious what your workaround was, @ryangittings?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants