How to add custom attributes to description meta tag?
function [your-theme]_page_attachments_alter(array &amp;$attachments) {
  $attachments = SwiftypeMetaDescription::add($attachments);
}





 class SwiftypeMetaDescription{
      /**
       * @param array $attachments
       * @return array
       */
      public static function add(array $attachments): array
      {
        // check if $attachments contain html_head
        if (empty($attachments['#attached']['html_head'])) {
          return $attachments;
        }
    
        // loop through HTML head
        foreach ($attachments['#attached']['html_head'] as $key =&gt; $attachment) {
          // check if element name is defined
          if (empty($attachment[1])) {
            // if it's not, skip element
            continue;
          }
          // if the element name equals 'description'
          if ($attachment[1] == 'description') {
            // add 'class' attribute
            $attachments['#attached']['html_head'][$key][0]['#attributes']['class'] = 'swiftype';
            // add 'data-type' attribute
            $attachments['#attached']['html_head'][$key][0]['#attributes']['data-type'] = 'string';
          }
        }
    
        return $attachments;
      }
    
    }