When looping through Channel entries, is there a way to provide users with a link they can click on that will take them to that specific Channel entry? I seem to recall seeing some "url" variable available within {exp:channel:entries} tag pair, but can't find it again.

Also, once I'm on that specific Channel entry page, how do I know which entry it is so I can display the rest of the Channel's data?

2 Answers 2


If you have an index or listing page, like products, your code maybe like

{exp:channel:entries channel="products" limit="10" orderby="date" sort="desc"}

    <div class="pic-wall"><a href=/product/profile/{url_title}"><img src="/images/product/{product_image_file}" alt="{title}"></a></div>


then on your product profile page, you'd want something like

{exp:channel:entries channel="product" limit="1"}

<hr />


Additionally, you can use the url_title="{segment_3}" to make sure the record exists, or the if no_results option so that random urls, if generated will result in a 404 call.

The key component is to either use the {url_title}, {entry_id}, {comment_entry_id_auto_path}, or {permalink}. There are a few more options, but they are basically variations of the above for example:

{url_title} will allow you to custom create the path to the entry like

<a href="{domain}/products/detail/{url_title}" title="{title}">{title}</a>

or you could use {url_title_path}. {url_title_path} assumes you've completed the details in channel profiles, when you were setting things up, so if you said the default path for products was products/details it will use that, but if you said it was products/index then it would have the wrong path.

I tend to use the {url_title} because I like the flexibility, one of the other developers I work with prefers using the {url_title_path} option. But both will create a link, so that you can design a template with detail specific fields.

Take a look at http://ellislab.com/expressionengine/user-guide/modules/channel/channel_entries.html#parameters to see all the various parameter options available to you.

  • OK - I understand url_title now. What I don't understand is the "profile page." How does it know which entry it's trying to display? Does it make certain assumptions based on the URL? Dec 26, 2012 at 1:15
  • No the {url_title}, is unique per section or you can use the {entry_id}, but the {url_title} is more SEO and user friendly. It would change <a href="{domain}/products/detail/{url_title}" title="{title}">{title}</a> to <a href="http://mydomain.org/products/profile/cat_knitting_tee_shirt" title="Cat Knitting Tee">Cat Knitting Tee</a> Dec 26, 2012 at 4:30

My preferred method is to use {comment_url_title_auto_path}. I find that this is the most future proof method since if your urls change in the future for some reason then you only need to make a change in the url settings for that specific channel and not throughout all of your templates. In your specific channel go to admin > channel Preferences > channel name and be sure to fill out the comment page url with the segment of where that channel should appear. For example if it's for your blog page which has a url like this domain.com/blog/url_title then in that setting you would put blog.

  • We always create a variable, called {domain} in the path.php or index.php file using global variables, that way, this <a href="{domain}/products/detail/{url_title}" title="{title}">{title}</a> will work. That maybe because we frequently use the old method of creating subsites, instead of MSM. Though most of the developers I know use relative paths. Dec 26, 2012 at 16:02
  • Why {domain}? Why not just use {site_url}? Dec 26, 2012 at 22:46
  • It's part of a grouping of global variables that we test against. I can't recall why we first needed it, but {site_url} was returning current url, and we had need for if these 3 criteria were match, the link would point to a sub site domain, like mydomain2.org, even if current domain was domain.org. Dec 27, 2012 at 5:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.