-3

Having the taxonomy tags in a field of a node in the main content block of the Content region, is a problem for me, as I would prefer having them inside a block so to better choose where they appear.

Can I put taxonomy tags in a block and if I can, how to prevent them from appearing in a field of a node?

2
  • Is this when viewing the node or editing the node? Commented Mar 27 at 21:23
  • When viewing the node.
    – heya
    Commented Mar 27 at 22:02

1 Answer 1

0

You can move them around "like a block" with Layout Builder, which is included in core. The positioning will still be within the content region, but it can be anywhere in the content region, and you can customize the design however you like. I would try this first.

But, if you really want a block, you can make one with Views. Create a view of type taxonomy and then create a block display for that view. To get the taxonomy terms for the current node, you will have to configure the arguments (contextual filters) correctly, which can be a little tricky. However, when you finish, you will have a block you can position wherever you like.

To stop the terms from appearing on the node once you have the block, go to Manage Display for the content type and set the terms field not to display.

5
  • @heya Views styling is pretty well documented and should be a separate question. You can style views however you want, but because it is so flexible, there are many ways to do so. Commented Mar 28 at 16:10
  • You could also create a custom view mode, add only the taxonomy field, create a View showing content (not fields) and select this view mode. Then the styling is that of a content type, not Views fields.
    – 4uk4
    Commented Mar 28 at 18:00
  • @PatrickKenny sorry I waffled a bit but the only thing I ask of is why I get <a> links which are inside <h2>?
    – heya
    Commented Mar 28 at 23:06
  • @heya Maybe you're using a badly coded theme? I really can't say anything without looking at the code. Guessing at the problem when code and details can be provided isn't a good use of anyone's time. Commented Mar 29 at 15:15
  • @PatrickKenny the theme is Olivero.
    – heya
    Commented Mar 29 at 19:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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