Summary token not fully handled in fields

Created on 20 November 2017, over 6 years ago
Updated 21 May 2024, about 1 month ago

In Drupal 8, if I add a field of type long text with summary and only fill the body, the default handling simply uses the summary field. It should use a trimmed version of the body.

I've prepared a patch which addresses this issue. A simple test is to look at the page source before and after applying the patch when Metatags is enabled. A node which only have the body field completed will have no description field before the patch is applied, and will have the additional content:

<meta property="og:description" content="(Trimmed version of body)" />

afterwards. I would have liked to have used the settings for the field from the view mode that's in use at the time but I couldn't locate a way to find it. This still does better than core though. Core assumes the field is always named body. This patch uses the field name (so field_article_body works in the project for which I've prepared this patch).

πŸ› Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡¦πŸ‡ΊAustralia Nigel Cunningham Geelong

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024