title: How can I use 11ty to generate one page per json file in _data subfolders?
body: <p>I'm trying to use 11ty to generate pages for a movie review site. The structure of my _data folder is as follows.</p>
  <pre><code>_data
    movies
      2017
        title1.json
        title2.json
      2018
      2019
  </code></pre>
  <p>I'm hoping for output like this.</p>
  <pre><code>_site
    movies
      2017
        title-1.html
        title-2.html
      2018
  </code></pre>
  <p>I would settle for output like this.</p>
  <pre><code>_site
    movies
      title-1.html
      title-2.html
  </code></pre>
  <p>But I can't work out how to get anything close! Any ideas? Here's my nunjucks template. <code>TitleWithYear</code> is a property in each .json file.</p>
  <pre><code>---
  pagination:
      data: movies
      size: 1
      alias: movie
      resolve: keys
  permalink: &quot;movies/{{ year??? }}/{{ movie.TitleWithYear | slug }}/index.html&quot;
  ---
  &lt;!doctype html&gt;
  &lt;html lang=&quot;en&quot;&gt;
    &lt;head&gt;
      &lt;meta charset=&quot;utf-8&quot;&gt;
      &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;
      &lt;title&gt;&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;h1&gt;{{ movie.TitleWithYear }}&lt;/h1&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>Edit: here's a repo showing the problem.</p>
  <p><a href="https://github.com/edmondbramhall/11ty-test1" rel="nofollow noreferrer">https://github.com/edmondbramhall/11ty-test1</a></p>
  <p>Without the permalink line in, it does work although not with my desired folder structure in the output.</p>
  <p>Edit: with Luke's help here's the pagination property I ended up with.</p>
  <pre><code>  permalink: &quot;movies/{{ movie.ReleaseYear }}/{{ movie.Id }}-{{ movie.Title | slug }}/index.html&quot;
  </code></pre>
  <p>I also created a global filter for slugify to supply a couple of settings by creating a file <code>.eleventy.js</code> in the root folder of my project, with the following content.</p>
  <pre><code>const slugify = require('slugify');
  module.exports = function(eleventyConfig) {
      eleventyConfig.addFilter(&quot;slug&quot;, function(value) {
          return slugify(value, { strict: true, lower: true });
      });
  };
  </code></pre>