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.
When using the token [node:summary] in metatag description everything is working fine.
But the same token in og:description doesn't filter the HTML and any tags from my body field.
A link will be easier to understand
http://israelmodernart.com/press-releases/le-festival-des-arts-de-jerusa...
Comment | File | Size | Author |
---|---|---|---|
#9 | metatag-n2700217-9.patch | 2.87 KB | DamienMcKenna |
#5 | metatag-n2700217-5.patch | 359 bytes | DamienMcKenna |
Comments
Comment #2
DamienMcKennaLooking at the page both the 'description' and 'og:description' tags show the same content:
The problem here is that you have an embedded media object at the beginning of the content. You might need to override the 'token' view mode for that content type and make sure the Media filter is enabled.
Comment #3
DamienMcKennaOTOH, maybe we could automatically filter out media strings?
Comment #4
DamienMcKennaThis patch adds a test for integration with the Media WYSIWYG module from the current Media 7.x-2.x codebase.
Comment #5
DamienMcKennaSo because the patch in #4 is adding a new test dependency it won't work, so it needs to be split into two pieces - first the test dependencies, then the other changes. This covers the test dependencies.
Comment #9
DamienMcKennaNow that the test dependencies have been added, lets go for the rest of the patch.
Comment #10
heyyo CreditAttribution: heyyo commentedThanks for this really quick reply !
I just applied your patch from the #9, but now my meta description and og:description are empty.
Comment #12
DamienMcKenna@heyyo: Yes, that's because the initial part of the node body field only contains a Media embed code.
Comment #13
DamienMcKennaCommitted.
Comment #14
DamienMcKenna@heyyo: You should try updating the 'summary' field for that node so it has actual text and not just a Media embed code.
Comment #15
heyyo CreditAttribution: heyyo commentedOk thanks I understand. But I was looking for an automatic way.
I never understood what was the purpose of the View Mode Tokens. I tried to use is but without success.
I have the module Smart Trim enabled. Unfortunately the usage of the Token View mode, and smart trim on the body field, which could filter HTML tags, doesn't do anything. The node:summary is still empty.
So I supposed I need to look on how to write a custom token which I will use instead of node:summary.
Or maybe there is a way to alter node:summary, which will fix its length only after removing media tags and html tags.
Comment #16
DamienMcKennaMaybe try customizing the 'body' field in the Tokens view mode, then changing the token to "[node:body]"?
Comment #17
heyyo CreditAttribution: heyyo commentedThanks Damien for your time. This is what I did. I'm not using node:summary but node:body.
I didn't use view mode of token but custom code to trim the node:body token.
Comment #19
mgzrobles CreditAttribution: mgzrobles commentedI don't think this issue is fixed only with "media_wysiwyg_filter" because you can use that format only with media and custom code.
I think is better use something like this