Search code examples
expressionengine

Expression Engine - How do I display external links in Category Archive List?


I have a series of entries that need to be displayed as part of a Category Archive.

I did the code this way:

{exp:channel:category_archive channel="botanical_gardens" style="linear"}
    {categories}
        <h3>{category_name}</h3>
        {if category_description}
            <p>{category_description}</p>
        {/if}
    {/categories}
    {entry_titles}
        <a href="{garden_url}">{title}</a><br />
    {/entry_titles}
{/exp:channel:category_archive}

This works with the exception of the URL which ties into the site url. Since each of these entries link to outside sites, how do I write the code to get the correct URL?

Thanks!


Solution

  • Custom fields can't be displayed within the Category Archive tag. Instead, you'll have to use the Channel Categories tag, and put a Channel Entries tag within it.

    {exp:channel:categories channel="botanical_gardens" style="linear" disable="category_fields"}
         <h3>{category_name}</h3>
         {if category_description}
             <p>{category_description}</p>
         {/if}
        {exp:channel:entries channel="botanical_gardens" category="{category_id}" disable="member_data|pagination|categories"}
            <a href="{garden_url}">{title}</a><br />
        {/exp:channel:entries}
    {/exp:channel:categories}