In cms admin, go to pages area, select the page under which you want to create a new page. Create new page and add markdown
Embedding an iframe lets you add javascript and such. To create an iframe based page:
Make sure you are in expert mode
In the Front matter add,
template: default
iframe: <iframe name, e.g /iframes/mypage.html>
style: 'height:90dvh;width:75dvw;border:none'
title: Page Title
process:
twig: true
In the folder /iframes, create your html page. This can be just like a regular html page.
If you want to put data (like json file) you can also put under /iframes area and fetch in the page.
As an example, a default.md could be
---
template: default
iframe: /iframes/jstest.html
style: 'height:90dvh;width:75dvw;border:none'
title: Books
process:
twig: true
---
{ % include 'iframe.html.twig' %}
jstest.html is
<div id="data_display"></div>
<script>
fetch('/iframes/data.json')
.then(response => response.json())
.then(data => {
console.log('Loaded JSON:', data);
// Example access:
data.videos.forEach(v => {
let content = document.getElementById("data_display").innerHTML;
content += "<br/>Title: " + v.title;
document.getElementById("data_display").innerHTML = content;
});
})
.catch(err => console.error("Cant load"))
</script>
And data.json is at /iframes/data.json