Problem/Motivation

On a site with comment_fragment.module working, any meta tags added by metatag.module will fail to render.

This is because comment_fragment.module changes the path to the comment to match the node path, and therefore this is being returned as TRUE from the _metatag_entity_is_page() function even though it isn't the page.

As metatag_entity_view() is only processed once per page and it already has a TRUE response, the node is not processed so no metatags are rendered.

Proposed resolution

If a comment is passed into _metatag_entity_is_page(), return FALSE straight away and ignore the comment entity. This let metatag_entity_view() run on the needed node entity and work successfully.

A patch is attached.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

opdavies’s picture

Issue summary: View changes
opdavies’s picture

Assigned: Unassigned » opdavies
Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, comment-fragment-conflict.patch, failed testing.

opdavies’s picture

Status: Needs work » Needs review
FileSize
857 bytes

Re-rolled patch.

DamienMcKenna’s picture

Status: Needs review » Reviewed & tested by the community

I think this makes sense. Testing the current functionality without Comment Fragment being installed, loading e.g. /comment/1 shows the meta tags for the node page the comment belongs to, because /comment/1 actually loads the node page that's associated with that comment.

DamienMcKenna’s picture

Title: Conflict with comment-fragment.module » Conflict with comment_fragment.module
Status: Reviewed & tested by the community » Fixed

Committed. Thanks!

  • Commit ede93e3 on 7.x-1.x authored by opdavies, committed by DamienMcKenna:
    Issue #2265447 by opdavies: Ignore comment entities, conflict with...
tvn’s picture

Thanks for being so quick, Damien.

opdavies’s picture

Hear, hear.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.