0

My channel entries do not include their respective categories in the title permalink.

How do I get each entries link to include the category in the url?

so my {title_permalink='showroom'} would end up being: showroom/category/cat_url_title/entry_title

{exp:channel:category_archive channel="portfolio" style="linear"} 
<div id="glance">
    {categories}
          <div class="skim-me">
        <ul>
    {exp:channel:entries channel="portfolio" limit="99" sort="asc" status="not Closed" category="{category_id}"}
    {portfolio_images}
     <li><a href="{title_permalink='showroom'}">{exp:ce_img:pair src="{cell_2}" width="300" height="200" crop="yes"}<img src="{made}" alt="" width="{width}" height="{height}" alt="{title}"/>{/exp:ce_img:pair}</a></li>
    {/portfolio_images}
    {/exp:channel:entries}

        </ul>
    </div> <!--end skim-me-->
    <br style="clear:both;" /><br />
     <h2><a href="{path='showroom'}">{category_name}</a></h2>
    <br /><br /><br />
    {/categories}     
      </div><!--end GLANCE-->

    {/exp:channel:category_archive}
2

Yes you can do that, but have to drop the reliance on {title_permalink} or {path}.

Your showroom/index template would catch both the listing and details pages, alternatively you can introduce additional elements to separate listing and details, for example:

/showroom/{cat_url_title} would use the index template

/showroom/details/{cat_url_title}/{url_title} would use a template called "details".

Your category URL would be:

<a href="/showroom/{cat_url_title}">{category_name}</a>

And your product URL would be:

<a href="/showroom/details/{cat_url_title}/{url_title}">

Your details page would use this channel:entries tag:

{exp:channel:entries channel="portfolio" status="not Closed" 
    url_title="{segment_4}"
    dynamic="no"
    require_entry="yes"}
    {if no_results}...{/if}

http://ellislab.com/expressionengine/user-guide/modules/channel/channel_entries.html#url-title

If you don't have the categories_archive tag, you'll need to include the categories variable pair to render out {cat_url_title}.

For your listing page, utilise Low Seg2Cat is one of the easiest options. http://gotolow.com/addons/low-seg2cat/docs

And your channel:entries tag for a specific category listing page could look like this (no category_archive tag):

{exp:channel:entries channel="portfolio" status="not Closed" 
    category="{last_segment_category_id}"
    dynamic="no"
    limit="99"
    paginate="both" }
    {if no_results}...{/if}

Obviously if you want to use the category_archive tag and list out all the categories and their entries, then that wouldn't require the category in the URL, but the above should give you enough to start you off or play with to create what you want.

This question touches on a similar listing structure: Displaying Products By Category

0

By default that's not the way that ExpressionEngine handles single entry pages or categories. It's an either/or. So if you had a single entry page then the URL would be:

http://domain.com/template_group/template/entry_title

For categories you can construct a category archive by using a category trigger. In this case 'category':

http://domain.com/template_group/template/category/category_name

This would list all the entries which are linked to that category.

By default there isn't a way to mix and match the two unless you use something like Freebie to tell EE to ignore certain segments in the URL. In your case you could tell it to ignore the category and category_name so that it just displays the entry as normal but you'd still have those segments in the URL. It includes the option to "break on category URL indicator" which you'll find useful in this case.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.