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.
Hello,
I have a content type that doesn't use the default body field at all. Is there a way to convince the [node:summary] token to look into other fields to build the summary? Or another token that does that?
Also, I could use my custom field's value as a token, but I can't find a way to shorten that to a reasonable length.
Generally asked: how do you deal with node summaries when you don't use the default body field?
Thanks,
Daniel
Comments
Comment #1
Daniel Wentsch CreditAttribution: Daniel Wentsch commentedComment #2
Daniel Wentsch CreditAttribution: Daniel Wentsch commentedOk, to trim the custom field's value when used as a token one can simply activate the token view mode in display settings and set the field formatter to trimmed. That solved it for now.
I'm still wondering if there isn't a way to get a summary from across any fields used in a content type.
Comment #3
DamienMcKennaI've opened up a feature request in the Token module's issue queue asking about this: #2300629: Optionally trim token output
Until that issue is resolved, lets leave this as postponed - at least you have an option for now.
Comment #4
DamienMcKennaBecause Dave didn't think the string trimming should be a default option in Token, I've opened a new issue in Metatag which covers it and more: #2309017: Automatically trim meta tag lengths (D7)
This new issue will cover this issue.
Comment #5
DamienMcKennaGoing to reopen this, we need a native way in Metatag to truncate long meta tag values.
Comment #6
DamienMcKennaClosed a duplicate: #2538416: Metadata description shows all my body text
Comment #7
DamienMcKennaThere are two parts to this issue:
Comment #9
DamienMcKennaFor anyone who runs into this problem, I started a documentation page of FAQs with some suggested solutions for this problem: https://www.drupal.org/docs/contributed-modules/metatag/frequently-asked...