redirect old links

This commit is contained in:
Nemo 2023-06-10 13:15:55 +05:30
parent 123161be22
commit 123d7d814b
3 changed files with 19 additions and 2 deletions

View File

@ -22,4 +22,22 @@ layout: default
<p><strong>Page not found :(</strong></p>
<p>The requested page could not be found.</p>
<p>This website only keeps articles from the last few days, so if you landed here from a link, it's likely that the article is no longer available. This page will automatically redirect to Beatroot News in such cases.</p>
</div>
<script>
// Get the current pathname
var currentPath = window.location.pathname;
// Extract the integer from the pathname using regular expressions
var match = currentPath.match(/\/(\d+)\//);
// Check if a match is found and the matched string is an integer
if (match && !isNaN(match[1])) {
// Extract the integer value
var integer = match[1];
// Redirect the user to the desired URL
window.location.href = `https://app.beatrootnews.com/#article-${integer}`;
}
</script>

View File

@ -9,7 +9,7 @@
- [ ] Highlight words
- [ ] Font adjustments
- [ ] Clear "read articles"
- [ ] Redirect 404 articles to upstream
- [x] Redirect 404 articles to upstream
- [ ] Add sign for "developing story"
- [ ] Fix tap target size in bottom footer.
- [ ] Make "/" in bottom footer using CSS after

View File

@ -1 +0,0 @@
env: production