fvaleri removed a comment on pull request #382:
URL: https://github.com/apache/camel-website/pull/382#issuecomment-638461004


   > This will lead to broken links. We can't do this without adding redirects 
from existing URLs to the new ones.
   
   Right. 
   
   Given that our 404 page URL is like this:
   ```
   https://camel.apache.org/blog/TestZero/
   ```
   We could add something as simple as:
   ```
   var baseUrl = "https://camel.apache.org/blog/";;
   var redirects = {
       'TestZero': baseUrl + '2019/12/TestZero/',
       'TestOne': baseUrl + '2020/01/TestOne/'
   };
   
   var url = window.location.href.replace(/\/$/, '');
   var oldPath = url.substr(url.lastIndexOf('/') + 1);
   
   var newPath = redirects[oldPath];
   if (newPath) {
       console.log('Redirecting ' + oldPath + ' to '+ newPath);
       window.location.replace(newPath);
   }
   ```
   
   It's just plain JS, but I'm not familiar with the website framework, so I 
don't know if something like this can be easily added. Such small feature could 
be useful in other situations too.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to