Sean Sperte

ExpressionEngine and the Power of URL Segments

24 April 2007

I had need today to serve a separated RSS feed of just my blog articles – sans links and quick-posts. At first I thought I’d simply duplicate my RSS template and call it something like rss-blog.php.

Yeah right. Not with ExpressionEngine and its support for URL segment conditionals around. Ladies and gentlemen, pay attention, because this is all it took: if segment_3 != 'blog'

Now, the when the URL is http://seansperte.com/rss/blog I can show unique content by placing it inside the if statement, like so:

  1. weblog="blog1{if segment_3 != 'blog'}|blog2{/if}"

See how that works? See how easy?