When there are multiple nodes on a page, i.e. node reference or term reference,
the function metatag_entity_view() gets called for every single entity.

To improve the performance, I suggest a static variable is create to avoid doing all the work after the metatags are loaded and stored in $entity->content['metatags'].

Comments

marcelovani’s picture

Status: Active » Needs review
StatusFileSize
new1010 bytes

Here is the patch

marcelovani’s picture

StatusFileSize
new1007 bytes

Re-patched the file. This patch works on current dev version.

damienmckenna’s picture

StatusFileSize
new1.09 KB

How about this instead - the function already had all of the necessary code, and there's no guarantee that the entities will be loaded in the order your patch assumes.

marcelovani’s picture

@DamienMcKenna Works well and is much simpler than my solution :)

damienmckenna’s picture

Assigned: Unassigned » damienmckenna

Will be reviewed next.

damienmckenna’s picture

Did the tag break?

damienmckenna’s picture

Status: Needs review » Fixed

Committed.

damienmckenna’s picture

Status: Fixed » Closed (fixed)

Last night saw the release of 7.x-1.0-beta1, so I'm closing all these "fixed" issues in the interest of tidying up the issue queue. Thank you all for your help getting us to this point!

damienmckenna’s picture

Assigned: damienmckenna » Unassigned
Issue summary: View changes