0

The title may be misleading if not confusing, so a little explanation is in order.

I have a basic article channel that feeds content to 38 different pages on a site based on the selected categories. I include summary information for selected articles on the home page of the site using the Relationship field and include a Read More link.

The challenge I am facing is how to link that home page summary to the correct page based on the entry category.

Any guidance on this will be greatly appreciated.

Thanks.

  • Is an article entry only linked to a single category? If the pages that you would direct the user to from the home page are dependent on category selection within the article entry, it would be a challenge to determine which category to tie to the "read more" button. Would an entry have a "main" category that would be the principal view? – Jean St-Amand Jan 16 '14 at 0:29
  • Hi Sean, most articles would only be associated with one category and in the event there were two, I would be content to have it link to one. Hope this helps. – forrest Jan 16 '14 at 1:39
1

If I understand your question correctly, it could be that you're using the incorrect syntax for fetching related categories. The docs don't make it very clear that you need to do it like this, prefixing the categories loop with the name of the relationship field:

{exp:channel:entries dynamic="no"}
    {rel_name}<a href="{rel_name:categories limit="1"}{category_url_title}{/rel_name:categories}">{title}</a>{/rel_name}
{/exp:channel:entries}

If I misunderstood the question, please add more detail as I'm not entirely sure what you're asking. It strikes me that you may be misusing categories here, since they are meant as a form of organisation that can accept multiple values. You should maybe look into using custom field radio buttons or a select dropdown instead.

| improve this answer | |
  • Hi James, you got it spot on. Thank you for grasping the essence of the issue and providing a solid solution. – forrest Jan 16 '14 at 22:48

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.