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.

How do I remove /Coments/ from a Single Post URL

February 15, 2008 9:09pm

Subscribe [3]
  • #1 / Feb 15, 2008 9:09pm

    slobizman

    42 posts

    I really don’t like the /comments/ in the URL when a single post is displayed, like this:

    MyDomain.com/blog/comments/post_name/

    I would prefer it like this:

    MyDomain.com/blog/post_name/

    I had a previous EE blog done where the developer made this change. But I have a new developer now who is not familiar with how to do this.  Can anyone enlighten me?

    Thanks.

  • #2 / Feb 16, 2008 2:21am

    Deron Sizemore

    1033 posts

    There are probably a couple other ways to do this, but the way that I would attempt to do it is with conditionals (if statements) inside of your blog/index template.

  • #3 / Feb 16, 2008 9:56am

    slobizman

    42 posts

    Thanks. But that’s not enough detail for me to understand what to do.

    I thought this thing with the /comments/ in the string was pretty odd, but I figured it was because I came from a WP background which doesn’t have it.  Plus it’s better for SEO to not have it.  But just now I went to the EE Showcase and looked at the blogs category. It turns out that the majority of showcased blogs also have removed the /comments/.  So, I’m relieved to now many people feel the same way. 

    So, please, if any pros here have done this can I get an idea how to do it?

  • #4 / Feb 16, 2008 10:53am

    Deron Sizemore

    1033 posts

    Hi,

    So how experienced is your new developer with EE? It will take a little bit of knowledge to do this and won’t be a real simple fix if he/she has zero knowledge of EE.

    with the /comments/ segment in the URL, that is simply your single entry template. The /blog/ segment is the template_group and the /comments/ segment is the template. The “comments” template is what holds your html/ee tags to display the full single entry from a weblog.

    You can look at my blog for example. If you click on one of my blog entries, it takes you to /blog/article/ as I’ve created my full entry template as “article” instead of “comments.” Naming it article just made more sense to me, but it’s purely personal preference.

    So, what you have happening right now is that on your blog, you have a link around the blog title that probably looks like this:

    <a href="http://{title_permalink=" title="{title}">{title}</a>

    which tells EE to take the user to the “comments” template once that link is clicked.

    If you wanted to take out the comments template, you would have to use conditional statements to display all of the code inside of your /blog/index template inside of the EE control panel.

    Hope that helps?

  • #5 / Feb 16, 2008 1:22pm

    tbritton

    714 posts

    The way I would do it would be to edit the index page of your site’s root template group to have a conditional in there that made it act like a comments page when the right condition was met. If you use that also to show your articles (meaning you use a comment page to show all articles), testing the segment might work:

    {if segment_2==""}
    regular index page code
    {/if}
    {if segment_2!=""}
    comment code
    {/if}

    Depending on your situation, you may have to test for segment_3 or another segment for this to work.

    Anyone have any more suggestions how a test could be performed?

    Terry

  • #6 / Feb 16, 2008 1:46pm

    Deron Sizemore

    1033 posts

    Thanks Terry, That’s what I was trying to transfer from my brain to my fingers, but I think I came off more talking in circles than anything. 😉

    Also, if I may ask, I know you said that having the /comments/ in the URL isn’t search engine friendly… if you ask me, it’s not search engine unfriendly and I don’t see it as a big deal to have the extra segment in there. Can you provide a link or anything where you’ve read that having the extra segment in there causes problems in search engines? I always was under the impression that having the odd dynamic characters like “?” in the URL made it unfriendly, not text segments.

  • #7 / Feb 16, 2008 2:08pm

    tbritton

    714 posts

    I always was under the impression that having the odd dynamic characters like “?” in the URL made it unfriendly, not text segments.

    I have always heard the same thing.

    A vastly promoted feature of EE is its SEO friendly urls, so I don’t know what the OP is referring to.

    Terry

  • #8 / Feb 17, 2008 11:20am

    slobizman

    42 posts

    Thanks Terry, That’s what I was trying to transfer from my brain to my fingers, but I think I came off more talking in circles than anything. 😉

    Also, if I may ask, I know you said that having the /comments/ in the URL isn’t search engine friendly… if you ask me, it’s not search engine unfriendly and I don’t see it as a big deal to have the extra segment in there. Can you provide a link or anything where you’ve read that having the extra segment in there causes problems in search engines? I always was under the impression that having the odd dynamic characters like “?” in the URL made it unfriendly, not text segments.

    You can read the book SEObook from SEOBOOK.com, written by the top expert in this field. The further back from the domain name that the article title is, the worse. Logically, I guess, you can see how a search engine would assume it is less important the further down the directory chain in a URL it is.

    The index.php part is very bad and I’m surprised that EE still has it this way and in fact removing it is “unsupported.”  Interestingly, you see the majority of professionally designed, high end EE blogs not having the index.php and not having the /comments/, which to me if I owned EE, would indicate the desires of the designers to change the default.

    The SEOBook is the absolute best $79 (maybe it’s higher now, I bought it two years ago) you’ll ever spend. It’s a huge ebook packed with very critical information for increasing traffic.

    By the way, I have found the answer to my own post. I’m surprised that no one mentioned this EE Wiki page considering a lot of people are following it:

    http://expressionengine.com/wiki/Cruft_Free_URLs/

  • #9 / Feb 17, 2008 1:45pm

    Deron Sizemore

    1033 posts

    Yeah, I’ve heard Aaron knows his SEO stuff, but I had never heard of the URL title stuff, but it does make sense I guess. I’ll do some more research.

    Thanks for the wiki link, I didn’t know it existed. It looks a little more complicated than need be though. At least from my experience, doing what Terry mentioned above with the if segment conditionals would be the easiest way to go about it.

    As far as index.php, I don’t like it at all and I remove it. It’s very easy to remove. Just takes copying and pasting some code from the wiki into your .htaccess file and that’s it.

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

ExpressionEngine News!

#eecms, #events, #releases