1

I'm quite new to EE2 although fairly proficient with HTML, etc. This may seem as an easy question, but for the life of me, I cannot figure out how to make a clickable list of entries from our blog.

Here's the current code:

{exp:channel:entries channel="blog" limit="10"}
<li><a href="#'>{title}</a></li>
{/exp:channel:entries}

I'm trying to list all of the entries from the blog in a sidebar on the site. The problem is that the entries show up fine, but they all link to the same blog article no matter what I put in the "#" part. The list of blog entries shows up fine, but I can't get them to link to their source article.

How do I make it so that the listing treats each Title as separate link and links to the proper blog article?

I've searched the parameters field and haven't been able to find one that does what I want it to do. Am I just doing it all wrong?

Thank you so much for your help.

3

If you use the {url_title} for the href that should do the trick:

{exp:channel:entries channel="blog" limit="10"} <li><a href="{url_title}">{title}</a></li> {/exp:channel:entries}

Also you might need to add the dynamic="no" parameter to stop EE limiting the list based on the URL e.g. if you are on a single entry page. If that's the case try this instead:

{exp:channel:entries channel="blog" limit="10" dynamic="no" disable="categories|custom_fields|member_data|pagination"}<li><a href="{url_title}">{title}</a></li>{/exp:channel:entries}

Notice I added the 'disabled' parameter too? That helps speed things up and is good practice when you you only want a list of entry titles like this and don't need custom fields, categories or member data and pagination.

Hope that helps and all makes sense you can read more in the docs

| improve this answer | |
  • Oh my gosh...thank you. I actually tried the {url_title} parameter, but it didn't work until I added the extra bit of code you provided. I've been pulling my hair out all day on this, even after reading the documenation. I'm so glad I asked. I'll be sure to research this more thoroughly. Thank you very much for your help! – ArchangelX Nov 6 '13 at 9:25
  • No problem at all ArchangelX - don't forget to upvote this if the answer is useful too. – Jez Swinscoe Nov 6 '13 at 9:28
  • Once I get 15 rep, I'll certainly make sure to do that. Mahalo! – ArchangelX Nov 6 '13 at 9:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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