diff --git a/source/_posts/ejs.md b/source/_posts/ejs.md index 534a253..91dd1a9 100644 --- a/source/_posts/ejs.md +++ b/source/_posts/ejs.md @@ -12,6 +12,7 @@ intro: EJS(Embedded JavaScript) is a simple templating language that lets you generate HTML markup with plain JavaScript. plugins: - copyCode + - runCode --- @@ -58,10 +59,11 @@ Pass EJS a template string and some data. ### Browser Support ```html - + ``` diff --git a/themes/coo/layout/_partial/scripts.ejs b/themes/coo/layout/_partial/scripts.ejs index 0628c4b..e057c0c 100644 --- a/themes/coo/layout/_partial/scripts.ejs +++ b/themes/coo/layout/_partial/scripts.ejs @@ -185,6 +185,28 @@ } } + if (language === 'html' && document.querySelector('h1').textContent.includes('EJS')) { + config = { + ...baseConfig, + markup: { + language: 'ejs', + content, + }, + script: { + language: 'javascript', + content: "window.livecodes.templateData = {\n userLoggedIn: false,\n user: { username: 'geddy', email: 'geddy@example.com' },\n users: [\n { username: 'geddy', email: 'geddy@example.com' },\n { username: 'neil', email: 'neil@example.com' },\n { username: 'alex', email: 'alex@example.com' },\n ],\n};\n", + }, + tools: { + status: 'open', + }, + customSettings: { + "template": { + "prerender": false, + }, + }, + } + } + if (['php'].includes(language)) { config = { ...baseConfig,