Score:0

Display metatag description of nodes in taxonomy term views

ru flag

In Taxonomy term views, where are displayed shorten nodes I want to display node's metatag description instead body summary, but it doesn't work. I'm using Metatag module with it's submodule Metatag: Views. Views looks like this: Metatag field in views Please help

cn flag
IMO you're looking at this the wrong way round - if you need an alternate description for the node, that should be in a field, where it can be accessed natively using Views and other parts of the system. Then it's a simple matter of changing the description metatag to the token for that field, and you have a robust solution
Drazen avatar
ru flag
But I already have filed in metatag description of node, it is not solution to duplicate that field in new one. Is there any way to access it in Views?
cn flag
I wouldn't recommend duplicating it, rather moving it from the metatag field into its own field and referencing it. If the data belongs to the node, keep it in the node. Only keep it in the metatags field if it's strictly only being used as meta data. But to answer your question: no, I don't believe the metatags module makes that level of granular data available to Views. It's not impossible to do so, but would require code
cn flag
See this issue: https://www.drupal.org/project/metatag/issues/3027873, the patch in #7 is reported to work and would solve your problem
Score:0
ru flag

THANK YOU Clive. I implement patch from this two files, this MetatagViewsFormatter.php and this MetatagFormatter.php from here Provide field formatter to output meta tags on-page, e.g. for use with Views (D9) and it works! Now I have in views metatag field this options:

metatag values including description

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.