From d9d55620a6f4f44b2c5069da107b2b3b111390ed Mon Sep 17 00:00:00 2001
From: navewindre <boneyaard@gmail.com>
Date: Wed, 11 Feb 2026 02:05:39 +0100
Subject: seo renderer

---
 web/src/jsx.tsx | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

(limited to 'web/src/jsx.tsx')

diff --git a/web/src/jsx.tsx b/web/src/jsx.tsx
index a92fc11..749e93f 100644
--- a/web/src/jsx.tsx
+++ b/web/src/jsx.tsx
@@ -11,8 +11,9 @@ export interface Route {
 const routes: Route[] = [];
 let err404page = "/";
 let rootId = "moneyjsx-root";
-let onprenavigate: Function = () => {};
-let onpostnavigate: Function = () => {};
+let defaultTitle = "";
+export let onprenavigate: Function = () => {};
+export let onpostnavigate: Function = () => {};
 
 function routeForPath( route: string ) : Function | null {
   if( !routes[route] ) {
@@ -37,6 +38,10 @@ export function setRootId( rootId: string ) {
   rootId = rootId;
 }
 
+export function setDefaultTitle( title: string ) {
+  defaultTitle = title;
+}
+
 /**
  * adds a route component to the routes list
  * the component function must return either a jquery or a DOM element
@@ -87,6 +92,7 @@ export function navigate( route: string ) {
     window.history.pushState( {}, null, url.href );
 
   onprenavigate();
+  setTitle();
   const el = $( cb() );
   curRoute = cb;
 
@@ -111,6 +117,7 @@ export function navigateParams( route: string, params: any ) {
     window.history.pushState( {}, null, url.href );
 
   onprenavigate();
+  setTitle();
   const el = $( cb() );
   curRoute = cb;
 
@@ -143,6 +150,7 @@ export function navigateParamsSilent( route: string, params: any ) {
     return navigateSilent( err404page );
 
   onprenavigate();
+  setTitle();
   const el = $( cb() );
   curRoute = cb;
 
@@ -162,6 +170,7 @@ export function navigateSilent( route: string ) {
     return navigateSilent( err404page );
 
   onprenavigate();
+  setTitle();
   const el = $( cb() );
   curRoute = cb;
 
@@ -185,6 +194,7 @@ export function onPopState() {
     return;
 
   onprenavigate();
+  setTitle();
   const el = $( cb() );
   curRoute = cb;
 
@@ -251,7 +261,7 @@ export function createElement( tag: any, props: any, ...children: any ) {
       const lowercaseName = name.toLowerCase();
 
       if( lowercaseName in window ) {
-        element.addEventListener( lowercaseName.substring(2 ), value );
+        element.addEventListener( lowercaseName.substring( 2 ), value );
         continue;
       }
     }
@@ -288,3 +298,7 @@ export function createElement( tag: any, props: any, ...children: any ) {
 export function createFragment( props: any ) {
   return props.children;
 }
+
+function setTitle() {
+  document.title = defaultTitle;
+}
-- 
cgit v1.2.3

