Can Jekyll serve content based on a URL parameter?

I’m migrating a blog from WordPress to GitHub pages. In the logs for my site, I’ve noticed that there are many requests like this:

GET /wp/?feed=atom

This 301 redirects to the ATOM feed for the site.

Read More

I’d planned to use httrack to scrape my site and migrate all the static content. But this presents a problem. Is there any way to replicate the /wp/?foo=bar redirects using Jekyll?

Related posts

Leave a Reply

1 comment

  1. You can use Jekyll redirect_from plugin which is one of the rare plugin that can be used on github pages.

    The only problem is that yoursite.github.io/wp/?foo=bar from the server point of view is yoursite.github.io/wp/index.php?foo=bar. So, any ?foo=bar is resolved to the same file.

    I you have only your xml feed to redirect, this does the trick :

    ---
    layout: null
    redirect_from:
      - /wp/
    ---
    content ...
    

    If you have multiple files to redirect, you will have to switch to a javascript solution from a wp/index.html file.