Generate one page with programmatic API #2674
Unanswered
mark-reason
asked this question in
Q&A
Replies: 1 comment 3 replies
-
|
This worked for me locally: // build.js
const Eleventy = require("@11ty/eleventy");
(async function() {
let elev = new Eleventy("src/pages/two.liquid");
await elev.write();
})();Ref: https://www.11ty.dev/docs/programmatic/#changing-the-input-and-output-directories Where my fake site looks like this: tree -aI node_modules
.
├── .eleventy.js
├── build.js
├── package-lock.json
├── package.json
├── src/
│ ├── index.liquid
│ └── pages/
│ ├── one.liquid
│ ├── three.liquid
│ └── two.liquid
└── www/
└── two/
└── index.html
4 directories, 9 filesAnd the output looks like: npm run build
> [email protected] build
> node build
building...
[11ty] Writing www/two/index.html from ./src/pages/two.liquidAnd if I do a full build (using the CLI) it looks like this: npx @11ty/eleventy
building...
[11ty] Writing www/index.html from ./src/index.liquid
[11ty] Writing www/pages/one/index.html from ./src/pages/one.liquid
[11ty] Writing www/pages/three/index.html from ./src/pages/three.liquid
[11ty] Writing www/pages/two/index.html from ./src/pages/two.liquid
[11ty] Wrote 4 files in 0.02 seconds (v1.0.2)… or, you can use the CLI to build a single page using the npx @11ty/eleventy --input src/pages/three.liquid
building...
[11ty] Writing www/three/index.html from ./src/pages/three.liquid
[11ty] Wrote 1 file in 0.02 seconds (v1.0.2) |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Is there a way to use the Eleventy programmatic API to generate just one page and also feed in the data it uses at run time?
Beta Was this translation helpful? Give feedback.
All reactions