The official blog of PodQueue, the missing "Listen Later" for audio on the web.


Removing "?ref=producthunt" from your search results

After launching PodQueue, I submitted it to many of the usual product launch sites, including Product Hunt. In submitting PodQueue, I set the webpage to be “”, which Product Hunt turns into the outbound tracking link “”, which in turn resolves to “”. Fair enough, I could do some click/conversion tracking from that if I wanted to, although I didn’t ask for it and there’s no way to turn it off.

Unfortunately, though, what started happening after this is that for various search engines, I now had two search results for the same page competing with each other, “” (which I wanted people to see and click on) and “” (it’s the same page but with a not-even-correct referrer now!).

I took a double-barrel approach to solving this, and while you may be able to fix it with just one or the other, I fixed it with both, and no longer see duplicated entries for my landing page in search results.

The first was to use an HTTP 301 Moved Permanently redirect whenever a ref parameter is passed. Since PodQueue runs on Rails, I could do this with a line in the relevant controller action:

redirect_to root_url, status: :moved_permanently and return if params['ref'].present?

Now, requesting “” will tell clients that they should permanently redirect to “” instead.

The second technique was to introduce a metadata tag inside the <head> of the HTML returned at the root URL:

<link rel="canonical" href="">

This tells clients that parse the HTML that the canonical representation of this link is “”.

Note that you shouldn’t hardcode this in your layout, since then every page will say that the canonical URL is the root URL - you should set it dynamically or conditionally depending on what you want to accomplish.

With both of these techniques deployed and in production, search engines now show just my preferred URL for my site instead of two duplicate entries!