Score:0

how to update metatags using metatag_manager?

pl flag

I have drupal 10 installation, I am trying to update robots metatag for old articles/pages, I am writing an update_hook .

I found this really clean way to get the metatags parameters :

$metatag_manager = \Drupal::service('metatag.manager');

First, get the tags from the entity (usually from a node):

$tags = $metatag_manager->tagsFromEntityWithDefaults($node);

and then generate the meta tag values:

$metatags = $metatag_manager->generateTokenValues($tags, $node);

However, is there a way to update the metatags using the metatag_manager ? I couldnt manage to update the metatags and save the node after.

KR, Asmaa

I sit in a Tesla and translated this thread with Ai:

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.