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.

Single Blog-Entry page shows all entry if parameter is missing

July 17, 2011 2:00pm

Subscribe [1]
  • #1 / Jul 17, 2011 2:00pm

    Milaan

    33 posts

    Hello,

    my default template group is “blog” and there i have an “index” which lists all blog posts and “article” which display only a single blog entry:

    /blog/article/life-sucks

    Now, if i remove the “life-sucks” in the url, EE again lists all blog entries because i didnt set the entry limit to 1. But i would like some kind of error message or a redirect.


    Also, i read Google SEO tips and Google says the page should be build in a way, a user can delete any “segment” in the url and gets a functional page. But as mentioned above the page /blog/article is a dead end. Either it lists all blog entries which /blog/index already does or it will display an error.

    I guess the only method which will work is to make heavy use of conditionals in the index file to to get something like that, where the overview and single entry page have different layouts:

    /blog/index => all entries
    /blog/index/life-sucks => single entry


    Maybe someone has some nice ideas and my questions is not too confusing 😊

    Tobias

  • #2 / Jul 17, 2011 3:52pm

    Lisa Wess

    20502 posts

    Hi, Milaan -

    Have you seen my series on SEO, specifically the article on 404 headers?

    I think that should help get you moving in the right direction. =)

  • #3 / Jul 17, 2011 4:24pm

    Milaan

    33 posts

    Great, that article helped a lot. Excatly this parameter require_entry=“yes” was missing.

    But still when a user removes the article name from the url he is presented a 404 page. Is there any best practise when i want a different layout for the overview page and the single entry page to combine both into the index page with conditionals? Or is it prefered to use seperate files like index.php and article.php.

    Oh and one more question:

    The Blog index.php is recognizing when /blog/category/name is called. Is there also a function to check is /blog/2011/07 is called? I mean, EE is displaying the correct content but i would like to display a custom title on the page when a category is called, or a date.

    Thank you 😊

    Tobias

  • #4 / Jul 17, 2011 4:31pm

    Lisa Wess

    20502 posts

    Tobias -

    It really depends on the designer.  I prefer to use separate templates and fewer conditionals as that is more optimal for performance and it’s easier to read for seeing the code, at least to me.

    You can use the Category Heading tag, but there isn’t an equivalent for date, so you’d need to use conditionals there to check for years, which could be messy if you might have multiple years.  A feature request may be a good idea there, with a custom plugin if you need the feature immediately.

    Does that help?

  • #5 / Jul 17, 2011 4:36pm

    Milaan

    33 posts

    Yeps, thank you for answering my question so fast.

    Tobias

  • #6 / Jul 17, 2011 4:37pm

    Lisa Wess

    20502 posts

    My pleasure, Tobias.

    If you have any other questions, please start a new thread and let us know.  And enjoy the rest of the weekend!

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

ExpressionEngine News!

#eecms, #events, #releases