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.

removing link from article detail page

June 30, 2011 10:22am

Subscribe [4]
  • #1 / Jun 30, 2011 10:22am

    jamie dollard

    3 posts

    Hi,

    I’ve been looking for this on the forum but no luck so far. I think it’s an easy one and I’m overlooking something.

    I have my articles page set up and each one of my posts have a link on the title to the detail page however when I then go to the detail page “site.com/article/post-name” the link is still there.

    How do I hide the link if I am on the detail page? Following this I’d like to add a link back to the index page, but only want it to be displayed on the detail page. Any help would be greatly appreciated,

    thanks,
    a grateful noob

  • #2 / Jun 30, 2011 12:47pm

    lebisol

    2234 posts

    Sounds like you are reusing the same template.
    Can you share the code that makes the article and the permalink part?

  • #3 / Jun 30, 2011 7:22pm

    jamie dollard

    3 posts

    Oh, I guess thats wrong. Yeah I am using the same template because I wanted to keep the file path “sitename.com/articles/post-name”.

    Are there any tutorials that you could point me to for setting this up.

    Thanks,
    J

  • #4 / Jun 30, 2011 8:07pm

    lebisol

    2234 posts

    Generally you would want to dedicate a ‘viewing’ or ‘reading’ template that presents single entry.
    So your url structure would be:
    sitename.com/template_group/template/entry-title
    sitename.com/articles/view/post-title

    Look over: http://expressionengine.com/blog/article_list/category/importance_of_semantics/

  • #5 / Jul 01, 2011 1:08am

    John Henry Donovan

    12339 posts

    jamiedollard,

    You can achieve this with something like the following in your articles/index template

    {if segment_2 == ""}
    {exp:channel:entries channel="articles" limit="10" dynamic="no"}
    <h2>{title}</h2>
    <p>{summary}<br />
    <a href="http://{path=articles}/{url_title}">Read More</a><br />
    <hr ><br />
    {/exp:channel:entries}<br />
    {/if}</p>
    
    <p>{if segment_2 != ""}<br />
    {exp:channel:entries channel="articles" limit="1" dynamic="no" url_title="{segment_2}"}</p><h2>{title}</h2>
    <p>{summary}<br />
    {body}<br />
    <a href="http://{path=articles/index}">Back to Index</a></p>
    
    <p>{/exp:channel:entries}<br />
    {/if}

    Let us know if that works for you

  • #6 / Jul 02, 2011 6:08am

    jamie dollard

    3 posts

    Wow, thanks very much John! This was exactly what I was after! I hadn’t thought of using segments. I will look into this as it looks like I will probably use this a lot. Really appreciate the assistance.

    cheers,
    J

  • #7 / Jul 05, 2011 5:59pm

    Sue Crocker

    26054 posts

    Glad John was able to help. Don’t hesitate to post again as needed.

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

ExpressionEngine News!

#eecms, #events, #releases