Skip to content

Commit

Permalink
make all front-matter available in KS rendering (#3503)
Browse files Browse the repository at this point in the history
* make all front-matter available in KS rendering

Fixes #3258

* better error handling in case it's falsy
  • Loading branch information
peterbe authored Apr 13, 2021
1 parent 646770c commit 849fcfc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
12 changes: 4 additions & 8 deletions kumascript/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,10 @@ const renderFromURL = async (
const [renderedHtml, errors] = await renderMacros(
rawHTML,
{
...{
url,
locale: metadata.locale,
slug: metadata.slug,
title: metadata.title,
tags: metadata.tags || [],
selective_mode,
},
...metadata,
url,
tags: metadata.tags || [],
selective_mode,
interactive_examples: {
base_url: INTERACTIVE_EXAMPLES_BASE_URL,
},
Expand Down
5 changes: 4 additions & 1 deletion kumascript/macros/Compat.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ Example calls
*/
var query = $0;
var query = $0 || env['browser-compat'];
if (!query) {
throw new Error("No first query argument or 'browser-compat' front-matter value passed");
}
var depth = $1 || 1;
var output = `<div class="bc-data" id="bcd:${query}" data-depth="${depth}">
If you're able to see this, something went wrong on this page.
Expand Down

0 comments on commit 849fcfc

Please sign in to comment.