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.

Search results not working with Pages module

January 29, 2011 4:45pm

Subscribe [2]
  • #1 / Jan 29, 2011 4:45pm

    gcylinder

    49 posts

    So all of my entries use the Pages module, and the Pages page_url’s are attributed to my navigation links. All works well there.

    With search results, it looks like the correct page_url’s are being returned, but when I click one from results, the page brought up has the content displayed without the styles and images. But if I were to click the identical link from the navigation, it works. Here is my search results tag set:

    {exp:search:search_results}
    <a href="http://{page_url}">{title}</a>            
    {/exp:search:search_results}

    Here’s a link to an entry that works when clicked from the main navigation:
    http://www.mywebsite.com/index.php/what_are_you_packaging/coffee

    That exact same link is reported in search results, but again, returns a page that does not utilize the template’s image or stylesheet links correctly.

    It’s weird. I mouseover the link from navigation and mouseover the link in search results and they are identical.

  • #2 / Jan 30, 2011 2:59pm

    gcylinder

    49 posts

    I figured something out. The navigation links, using pages URLs are formed correctly:

    http://www.mywebsite.com/index.php/what_are_you_packaging/coffee

    But the search results are putting a trailing slash on the end:

    http://www.mywebsite.com/index.php/what_are_you_packaging/coffee/

    How do I get search results using the {page_url} to leave off the trailing slash?

  • #3 / Jan 31, 2011 2:28pm

    Barry Cogan

    291 posts

    Hi gcylinder,

    Is there a trailing slash in your pages tab in the entry?

    That is a lot of extra work you are doing when there is a much simpler way of getting your desired results with out having to set a page for each entry.

    I would suggest you read this blog series we have (starting at the bottom and working your way up). It explains the use of using the entry url_title as the address rather than creating a page for each entry.

    Best regards,

    Barry

  • #4 / Jan 31, 2011 3:49pm

    gcylinder

    49 posts

    No, there is no trailing slash in my entries.

    I appreciate the suggestion. I can’t use the url_title for the address because several pages have the same url_title. It doesn’t seem like that much more work to give each entry a Page URL vs selecting a category anyway. Besides that, this is how the site has already been set up, so I wouldn’t have time to go back and re-hash everything now. I just wanted to know why the search results pull that trailing slash out when one doesn’t exist in the entry.

    At any rate, I seem to have solved the issue with the search results by forming it this way. Thanks again for your response.

    {exp:search:search_results}
    <a href="http://www.mywebsite.com/index.php{page_uri}">{title}</a>
                
    {/exp:search:search_results}
  • #5 / Jan 31, 2011 4:11pm

    Barry Cogan

    291 posts

    Hi gcylinder,

    I am glad that version works 😊  We used to have trailing slashes everywhere.  It appears we have missed one in the search results. Once replicate the issue I’ll get it added as a bug so we can deal with it.

    As for the URL_titles being the same: You can make the URL_title be anything you want. So where you would add the last unique bit you could instead change the URL_title to be what you want.

    A thought for future projects. It is not a lot of extra work but it takes away a lot of the cool automatic things expression engine can do for you.

    Best regards,
    Barry

  • #6 / Jan 31, 2011 4:25pm

    gcylinder

    49 posts

    Cool. Thanks for looking into that. Not a huge issue, but it seems simple enough to change if you replicated it on your end.

    On the URL_titles, my initial thought was that it’s just as easy to add a Pages uri as it is to enter different URL_titles. So that’s how it went. The build was easy either way and I don’t need it to do anything magical beyond that, but I take your point for future builds that require more flexibility.

  • #7 / Jan 31, 2011 4:59pm

    Barry Cogan

    291 posts

    Do!  You will never go back. Even for the simple stuff! 😊 

    Please feel free to post again with any future issues!

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

ExpressionEngine News!

#eecms, #events, #releases