All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

Producing correct results url when channel does not have specific URL.

ZEDG 13 Jan 2015 06:53 question, complete

Hi
I have a channel 'Content' which is just the 'pages' of the site. My template groups are setup using only the 'index' template: template_group/template

eg,
coaching/index
management/index

And my navigation (done using Navee): template_group/entry1 (from 'Content' channel)

coaching/schools
coaching/instructors
management/forms

The native EE simple search form, which i want people to be able to search the entries on the site (from the 'Content' channel) does not produce the correct search results page.

In channel preferences > path settings > channel URL ... ..my 'Content' channel does not have a specific url - since it is different depending on the template group.

eg, If i enter and save http://www.site.com/coaching/ into the field, then do a search for 'schools', the results display http://www.site.com/coaching/schools which is correct. But if i search 'forms' the results brings up http://www.site.com/coaching/forms instead of http://www.site.com/management/forms

So since the 'Content' channel does not have a specific 'Channel URL', would Low Search produce the correct search results to link to the correct page/entry?

Replies

  1. Low 13 Jan 2015 08:30

    This is basically the same answer as your previous question. Create the URL like you would in the native channel:entries tag.

  2. ZEDG 13 Jan 2015 14:45

    I'm not sure how this is the same as my previous question, since in this instance all entries i want to search come from the same channel - the difference in the url comes from the template group.

    Trying something similar to your post from the previous question (see below) does not work since how would the entry know which template group it below to:

    {if "{segment_1}" == "events"}
    {path="events/{url_title}"}
    {if:elseif "{segment_1}" == "media"}
    {path="media/{url_title}"}
    {if:else}
    ...something else
    {/if}


    Is it possible somehow, or can Low search determine the template group each entry belongs to?

  3. Low 13 Jan 2015 14:52

    Low Search (or EE itself, for that matter) doesn't know where you display a given entry. Due to the nature of EE, this can be anywhere, and on multiple places as well.

    So the question is this, really. If you'd output a list of those entries on the home-page of the site with the channel:entries tag, how would you link to each individual entry?

    If there's nothing in the entry itself to determine this, you might need to add it in order to create that URL.

  4. ZEDG 13 Jan 2015 15:12

    I am using Navee (not the Pages module) to link to entries via template group/entry.

    Ok, well the only way i can think of to get this to work then is to create categories for each template group. So when editing/adding a Content page entry, the user needs to manually specify which category (or template group) it belongs to..

    ..and then i can use the same method as noted in the previous questions response.

    Does this sound about right? .. and therefore Low Search cannot help me then.

    I appreciate all your help.

  5. Low 13 Jan 2015 15:17

    If you're managing the URLs via NavEE, then you might be able to use that add-on to retrieve the right URL? Something that takes an entry_id and returns the URL for that entry, perhaps? A quick look at their docs, and maybe some Crumb tag might be useful for you.

  6. ZEDG 17 Mar 2015 13:17

    Finally got back to looking into this. Using Navee/crumbs was not possible. I had to instead create categories for each of the template groups, and assigned each entry to one. I then used conditionals to determine what category each entry belongs to to produce the required result.

    Thanks very much for your help.