Skip to content

Document global.data.js caveats for vars getter and rendering#243

Open
bcomnes wants to merge 3 commits intomasterfrom
docs/global-data-caveats
Open

Document global.data.js caveats for vars getter and rendering#243
bcomnes wants to merge 3 commits intomasterfrom
docs/global-data-caveats

Conversation

@bcomnes
Copy link
Copy Markdown
Owner

@bcomnes bcomnes commented Apr 18, 2026

Closes #228

Adds a Caveats section to the global.data.js documentation covering four runtime behaviors that users currently discover through source diving or trial and error:

  1. page.vars is a computed getter that merges four sources on every access. Caching the result when reading multiple properties reduces redundant work, especially on large sites.
  2. page.vars throws if the underlying page module has a syntax error or runtime error. Wrapping in try/catch when iterating all pages prevents one broken page from aborting the whole function.
  3. page.vars.content for markdown pages is the raw markdown source string, not rendered HTML. renderInnerPage() is the path to rendered HTML.
  4. renderInnerPage() is available in global.data.js since it receives fully initialized PageData instances.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds documentation to the global.data.js section in the README to clarify runtime caveats that impact performance and build robustness when using PageData in global data aggregation.

Changes:

  • Document that page.vars is a computed getter (fresh merge on every access) and should be cached per page when reading multiple properties.
  • Document that page.vars access can throw and recommend try/catch while iterating pages.
  • Document guidance around rendered content access via renderInnerPage() from global.data.js.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
- Cache p.vars in try/catch example to avoid double-invoking the getter
- Broaden the .vars throw caveat to cover all init failures, not just vars module errors
- Correct the raw content caveat: markdown pages do not expose content via vars.content;
  point to pageFile.filepath for raw source and renderInnerPage() for rendered HTML
@coveralls
Copy link
Copy Markdown

coveralls commented Apr 18, 2026

Coverage Report for CI Build 24612616510

Coverage remained the same at 91.469%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 4070
Covered Lines: 3804
Line Coverage: 93.46%
Relevant Branches: 642
Covered Branches: 506
Branch Coverage: 78.82%
Branches in Coverage %: Yes
Coverage Strength: 73.63 hits per line

💛 - Coveralls

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md Outdated
Comment thread README.md
Comment thread README.md Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bcomnes
Copy link
Copy Markdown
Owner Author

bcomnes commented Apr 19, 2026

We might need to make this consistent with the other built in try catch the other or adds. Also maybe domstack shouod cache this?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document global.data.js caveats: vars getter, error handling, and raw content

3 participants