Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Original request
Diff not showing (Meta)Keywords, (Meta)Description fields while comparing revisions
Hi I have recently installed Diff module in drupal 7 site, before that I had Revisioning module working fine.
I really love what Diff actually does and beautifully compare pages contents with revisions..I wanted to know how Diff module can show other fields difference in the compare view like I cannot see (Meta)Keywords , (Meta)Description when I click on compare button, Diff only shows me body content and compare body contents only. please advise
Comment | File | Size | Author |
---|---|---|---|
#26 | metatag-n2217549-26.patch | 1.8 KB | DamienMcKenna |
| |||
#14 | metatag-n2217549-14.patch | 1.79 KB | DamienMcKenna |
Comments
Comment #1
Alan D. CreditAttribution: Alan D. commentedIntegration should be possible, if anyone is interested in writing this.
Simply loop through the metatag settings for the entity, and if enabled, load the new / old metatag records, loop through the old and new values and throw these into an array similar to this:
Not sure about access checks here, not up to date with this modules internal code / restrictions
Comment #2
Alan D. CreditAttribution: Alan D. commentedComment #3
abart83 CreditAttribution: abart83 commentedthank you, i am not a coder, is their any easier way to implement this feature in DIFF?
Comment #4
Alan D. CreditAttribution: Alan D. commentedMmm.... the internals of MetaTags is a bit much for a quick solution from me sorry.
The stub that I started trying to give this a stab...
file: metatag.diff.inc
Comment #5
Kuldeep K CreditAttribution: Kuldeep K commentedThanks, I wrote this :
Comment #6
DamienMcKennaThis is kkumarz' code in patch format.
Comment #8
Kuldeep K CreditAttribution: Kuldeep K commentedUpdated patch. using node->language instead of und.
Comment #9
Kuldeep K CreditAttribution: Kuldeep K commentedComment #10
Alan D. CreditAttribution: Alan D. commentedThere shouldn't be any need to just support Nodes and there were a few notices being thrown.
The code checks set $entity->metatags values that are set, figured this was the most lightweight option. If these are the defaults, this array may not exist.
Note that these are disabled by default and need to be enabled via Admin > Config > Content Authoring > Diff > Entities > ENTITY TYPE (/admin/config/content/diff/entities/). Figured this was the sane thing to do after 5 years where there was no support ;)
One todo in the patch, to insert the entity defaults rather than just a default string, but good enough without that support imho.
Comment #11
jacquesct CreditAttribution: jacquesct commentedDoes this patch allow us to set a proper canonical tag for the diff versions?
What's happening right now is sites use Diff and Metatags have tons of duplicate content issues as we're not able to properly set the current content node as the canonical content.
A way to properly set this would be very much appreciated.
Comment #12
Alan D. CreditAttribution: Alan D. commentedThis sounds unrelated albeit related to how the two modules integrate. A revision is difference to a published version, so this is likely the right default behaviour.
From workbench moderation
<link rel="canonical" href="http://DOMAIN/node/2554/revisions/7834/view" />
From Diff (running under workbench moderation)
<link rel="canonical" href="http://DOMAIN/node/2554/moderation/diff/view/7834/8052" />
I'd create a new issue describing the issue better in the metatags queue and the maintainers can assess the best path forward for dealing with it
Comment #13
DamienMcKenna@jacquesct: The architecture currently isn't designed for handling entity revision pages, you might need to add hook_metatag_metatags_view_alter() to a custom module and remove all meta tags from the page.
Comment #14
DamienMcKennaReroll.
Comment #17
DamienMcKennaI ran the tests locally and they all passed. Committed. Thanks all!
Comment #18
DamienMcKennaComment #20
DamienMcKennaThis was committed to the wrong branch. Doh!
Let's add it to the next release for D7.
Comment #22
DamienMcKennaNot knowing this issue existed, Antares89 added another issue and provided a patch there, so we'll give them credit too.
Comment #23
DamienMcKennaComment #24
DamienMcKennaI need to work out what the next release of Metatag for D7 will be and include this. Because *facepalm*.
Comment #25
DamienMcKennaComment #26
DamienMcKennaRerolled.
Comment #28
DamienMcKennaCommitted. To the *correct* branch this time :-)