11ty / 11ty/docs

JavaScript template docs don’t discuss exporting a data object and render function directly

Open
#1,824 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Nunjucks
Stars
547
Forks
726
Avg merge
2h 23m
Merged PRs (30d)
3

Description

I can’t find anywhere in the documentation for JavaScript templates information about exporting a data object and a render function, like this:

export const data = {
  // ...
};

export function render () {
  // ...
}

I only discovered that it was possible to construct JavaScript templates this way when looking at the pagination docs, where the 11ty.js and 11ty.cjs examples show how you can export these directly without wrapping them in a class.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the JavaScript templates documentation and compare it with the pagination documentation’s 11ty.js and 11ty.cjs examples. Document that templates can export a data object and render function directly, with a representative example or link, so readers can find this pattern without searching the pagination page.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.