mirror of
https://git.waldn.net/git/knotteye/satyr.git
synced 2025-04-21 03:07:10 +00:00
Update URL when navigating to new pages and push state to history in client-side SPA
This commit is contained in:
parent
56c4b94a80
commit
cc3876ff4a
@ -1,5 +1,6 @@
|
||||
async function render(path){
|
||||
var context = await getContext();
|
||||
history.pushState({}, context.sitename, location.protocol+'//'+location.host+path);
|
||||
switch(path){
|
||||
//nothing but context
|
||||
case (path.match(/^\/about\/?$/) || {}).input:
|
||||
@ -104,6 +105,9 @@ async function render(path){
|
||||
case "":
|
||||
render('/users/live');
|
||||
break;
|
||||
case "/index.html":
|
||||
render('/users/live');
|
||||
break;
|
||||
//404
|
||||
default:
|
||||
document.body.innerHTML = nunjucks.render('404.njk', context);
|
||||
|
Loading…
x
Reference in New Issue
Block a user