move goatcounter javascript to its own view or leptos does not accept it

This commit is contained in:
Philippe Loctaux 2024-12-06 16:35:54 +01:00
parent ef2a46cdc3
commit 0f9fca5a3f

View file

@ -42,13 +42,7 @@ pub fn shell(title: &str, children: impl IntoAny) -> AnyView {
</div>
</footer>
</body>
<script inner_html=r#"
window.goatcounter = {
path: function(p) { return location.host + p }
}
"#></script>
<script data-goatcounter="https://goatcounter.philt3r.eu/count" async src="https://goatcounter.philt3r.eu/count.js"></script>
{stats().into_any()}
</html>
}.into_any()
}
@ -67,3 +61,14 @@ pub fn content_page(title: &str, children: impl IntoAny) -> AnyView {
)
.into_any()
}
pub fn stats() -> impl IntoView {
view! {
<script inner_html=r#"
window.goatcounter = {
path: function(p) { return location.host + p }
};
"#></script>
<script data-goatcounter="https://goatcounter.philt3r.eu/count" async src="https://goatcounter.philt3r.eu/count.js"></script>
}
}