Skip to content

Commit

Permalink
load js as module
Browse files Browse the repository at this point in the history
  • Loading branch information
agahkarakuzu committed Sep 8, 2024
1 parent d0e02d0 commit 9936e8b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions api/myst_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ frontend_data.content.title if frontend_data.content.title else 'MyST Page' }}</title>
<link rel="stylesheet" href="{{ url_for('serve_theme', filename='styles.css') }}">
<script src="{{ url_for('serve_theme', filename='index.js') }}"></script>
<title>{{ frontend_data.content.title if frontend_data.content and frontend_data.content.title else 'MyST Page' }}</title>
<script type="module" src="{{ url_for('serve_theme', filename='index.js') }}"></script>
</head>
<body>
<div id="myst-article-root"></div>
<script>
<script type="module">
import { renderMystContent } from "{{ url_for('serve_theme', filename='index.js') }}";
const frontendData = {{ frontend_data | tojson | safe }};
window.addEventListener('DOMContentLoaded', (event) => {
if (window.renderMystContent) {
window.renderMystContent(document.getElementById('myst-article-root'), frontendData);
if (renderMystContent) {
renderMystContent(document.getElementById('myst-article-root'), frontendData);
} else {
console.error('renderMystContent function not found. Make sure the theme JS is loaded correctly.');
}
Expand Down

0 comments on commit 9936e8b

Please sign in to comment.