Using commas instead of custom separator in token replacement breaks Schema.org Recipe properties

Created on 30 August 2023, 10 months ago

Problem/Motivation

After upgrading to Metatag 2.0.0 and Schema.org Metatag 3.0.1, the recipeIngredient and recipeInstructions properties are output as strings instead of arrays. Both are configured with tokens of fields with multiple values. Also, the ingredient and direction values in the strings are separated by commas, when I have the custom separator set to '||'.

After investigation, it appears that the change made in https://www.drupal.org/project/metatag/issues/3367071 πŸ› Custom separator also used for string concatenation Fixed to use commas instead of the custom separator during token replacement, has broken this functionality.

Steps to reproduce

  • Install Metatag 2.0.0 and Schema.org Metatag 3.0.1
  • Set the custom separator to '||'
  • Set the recipeIngredient and recipeInstructions properties in the Recipe type to the token of a field with multiple values

Proposed resolution

The simple solution would be to revert back to using the custom separator during token replacement. I tested this locally and it did solve the issue with the recipeIngredient and recipeInstructions properties. However, this change was made for a reason and I'm not sure how best to handle the two use cases.

πŸ› Bug report
Status

Active

Version

3.0

Component

Code

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

Production build 0.69.0 2024