Tag Filter / Page Variant

I have a blog. I have blog posts displayed in various styles. I also have tags displayed along-side blog titles and clickable.

When I click a tag, it changes the url to /news/tag:TAG - is there a quick way for me to wrap a loop with something that checks for that URL structure?

Basically I want to render the blog page one way for the normal /news URL, and then completely differently for the virtual /tag:TAG Url parameter.

If url = “/news” -> normal blog layout -> else if url = “/news/tag:TAG” -> Tag layout!

I found the following in the docs re:tag filtering (found here), but no luck so far.

if($tag = param('tag')) {

Stand by…

Sure enough - I found a simple solution:

<?php if (param('tag')): ?>

  <!-- layout for tag:TAG url detected -->

<?php else: ?>

   <!-- normal non-tag layout -->

<?php endif ?>