Since the tag is urlencoded, you need to compare to the urldecoded value:
if ($tag === urldecode(param('tag'))) { continue; }
Since the tag is urlencoded, you need to compare to the urldecoded value:
if ($tag === urldecode(param('tag'))) { continue; }