Skip to content

Commit

Permalink
increasse number of paths segments 404 and add script to index
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaslangsch committed Jul 31, 2023
1 parent 070cdd0 commit 616e3bf
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions public/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@
<meta charset="utf-8">
<title>Lucas Langsch Portfolio</title>
<script type="text/javascript">
(function() {
var pathSegmentsToKeep = 2; // Defina o número de segmentos de rota a serem mantidos (neste exemplo, estamos mantendo um segmento além do nome de domínio)
var pathSegmentsToKeep = 0;

var l = window.location;
var segments = l.pathname.split('/').slice(0, 1 + pathSegmentsToKeep);
var newUrl = l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') + segments.join('/') + (l.search ? l.search : '') + l.hash;

window.history.replaceState({}, '', newUrl);
})();
var l = window.location;
l.replace(
l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') +
l.pathname.split('/').slice(0, 1 + pathSegmentsToKeep).join('/') + '/?/' +
l.pathname.slice(1).split('/').slice(pathSegmentsToKeep).join('/').replace(/&/g, '~and~') +
(l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '') +
l.hash
);
</script>
</head>
<body>
Expand Down

0 comments on commit 616e3bf

Please sign in to comment.