Files
blog/templates/layout.templ

35 lines
979 B
Plaintext

package templates
templ Layout(title string) {
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>{ title }</title>
<link rel="stylesheet" href="/static/style.css"/>
<script src="https://unpkg.com/htmx.org@1.9.6"></script>
</head>
<body>
{ children... }
<script>
document.body.addEventListener('htmx:beforeRequest', function(evt) {
evt.detail.elt.classList.add('loading');
});
document.body.addEventListener('htmx:afterRequest', function(evt) {
document.querySelectorAll('.loading').forEach(el => {
el.classList.remove('loading');
});
});
document.body.addEventListener('htmx:beforeSwap', function(evt) {
document.querySelectorAll('.loading').forEach(el => {
el.classList.remove('loading');
});
});
</script>
</body>
</html>
}