Linking to documents within an post based on category

Hello there,

We are using the Layout Builder to build a custom single post template.

We would like to be able to link to an accompanying category specific post using the same button. Each category has the same titled post available but with different content for each.

The button will be situated at the top of every post but not the accompanying posts. Please see the following URL and accompanying image - the buttons are indicated by the green arrow.

https://bswcarehomeplus.org.uk/respect/care-home-staff/

Single_Article_-Layout_Builder-_Pro

At the moment I am using Dynamic Content in Image > Setup > Link to link to the category, which I know is incorrect because this only links to the category itself and not the relevant post within that category.

For example, the button for Residents and Families in any post within the category respect should link to https://bswcarehomeplus.org.uk/respect/residents-and-families-respect/. In the category ehch the same button should link to https://bswcarehomeplus.org.uk/ehch/residents-and-families-ehch/. Is there a Dynamic Content option which will point to the correct version of the post based on the category being viewed?

Please note the category name at the end of the title - do I need this detail?

Also, are images the correct thing to use here? I had a menu set up originally but was not sure how to link that either!

I hope all of this makes sense!

Kind Regards,

Spencer

Hi Spencer,

Thanks for reaching out.
It seems that you have set the {{dc:term:url}} to the Image > Setup > Link. The {{dc:term:url}} is returning the current posts category. I have checked the link you are trying to add into the images and found those are single posts and you need to add the post URL link manually to the images you want.

Hope it helps.
Thanks

Hi @tristup,

Thanks for getting back.

Is there any way of automating this so the links automatically link to the correct post depending on the category being viewed?

My client wants to replicate this functionality: https://g-care.glos.nhs.uk/pathway/127/resource/11

The resource 127 would be the same as one of our categories.

To be honest, I do not know if this ‘toolbar’ is automated or the links added manually.

Kind Regards,

Spencer

Hi Spencer,

It seems that you want to show all the Categories and shows the category-related post while clicking into the specific category. If that is the case, you need to use the All Terms > Category to show the Category into the Layout and assign it to the Archive page.

Screenshot-2022-02-22-175505

Hope it helps.
Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.