ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

URL link to single entry to include entry title?

July 10, 2012 8:12am

Subscribe [2]
  • #1 / Jul 10, 2012 8:12am

    jackiewales

    37 posts

    I have a main menu link from my home page that links to the most recent book review.
    The link is isolated it does not sit within any ee brackets. It works fine and leads to http://www.mywebsite/main/books/ as expected and displays the latest article . Ideally I would like the link from the home page to include the article title(for seo purposes).  So that the link would need to be dynamic and look like http://www.mywebsite/main/books/latestarticletitle.
    Can this be done?

    <li><a href="http://{path=main/books}">Books</a></li>
    
    {exp:channel:entries channel="books" limit="1" }
     //book fields 
    {/exp:channel:entries}
  • #2 / Jul 10, 2012 9:19am

    glenndavisgroup

    436 posts

    Hi jackiewales,

    Try this:

    {exp:channel:entries channel="books" limit="1" }
    <li><a href="http://{path=main/books/{title}}">Books</a></li>
    {/exp:channel:entries}
    ...

    I hope that helps.

    Mike

     

  • #3 / Jul 10, 2012 9:35am

    jackiewales

    37 posts

    Hi Mike thank you most helpful.  The only problem would be that this link is part of a menu that points to different channels, it would mean that I would have to wrap each item in its own channel tags.

  • #4 / Jul 11, 2012 12:24pm

    Kevin Smith

    4784 posts

    You would have to wrap at least this item in its own Channel Entries tags, but that’s the way to accomplish this. May I ask where you’re running into a problem here?

  • #5 / Jul 11, 2012 12:28pm

    jackiewales

    37 posts

    Hi Kevin,
    I’m using seo lite and am looking to attach meta data to the article but its id needs to be included

  • #6 / Jul 13, 2012 10:52am

    Shane Eckert

    7174 posts

    Hello jackiewales,

    The only way to get the id is to include the channel entries loop.

    You can use the channel parameter to include multiple channels.

    Does this help?

    Thank you,

  • #7 / Jul 13, 2012 11:19am

    jackiewales

    37 posts

    Hi Shane,
    Yes that’s fine, thanks to all.

  • #8 / Jul 13, 2012 11:22am

    Shane Eckert

    7174 posts

    Hey jackiewales,

    Awesome! Glad that you are on your way!

    If you need anything else, please just let me know by opening a new thread.

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases