Closed bittlingmayer closed 6 years ago
we can have mlevn.org/
True, better than hardcoding.
But because it's static there is no way to do it server-side.
We can make the 404.html grab location.pathname
.
And we should make sure analytics loads fast on that page, so we get stats for those links.
<html>
<head>
<script>
const flairs = window.location.pathname.split('/').filter(f => f);
const query = flairs.map(f => encodeURIComponent('flair:' + f)).join('+');
const url = 'https://www.reddit.com/r/MLEVN/search?restrict_sr=on&q=' + query;
window.location.replace(url);
</script>
</head>
<body>
</body>
</html>
We could also split on +
.
In which cases should we actually show a 404? For example if it ends with /
it is probably not a query.
Done.
Try: mlevn.org/posts/language+startups
Also supports jobs, try:
mlevn.org/jobs/language
Would be ideal to redirect mlevn.org/language to https://www.reddit.com/r/MLEVN/search?q=flair%3Alanguage&sort=new&restrict_sr=on and so on.