Custom Meta tags: Allow - in the machine name of the tag

Created on 10 January 2025, 4 months ago

Problem/Motivation

I'm trying to add this custom metatag:
<meta name="format-detection" content="telephone=no">

When I configure the name with "format-detection" the machine name is created as "format_detection" which give me the following metatag in the HTML

<meta name="format_detection" content="telephone=no">

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

2.1

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @naveenvalecha
  • First commit to issue fork.
  • Pipeline finished with Failed
    4 months ago
    Total: 284s
    #395490
  • Pipeline finished with Success
    4 months ago
    Total: 272s
    #395500
  • Pipeline finished with Success
    4 months ago
    Total: 357s
    #395517
  • πŸ‡¨πŸ‡¦Canada sagesolutions

    The PR looks like it can handle <meta name="format-detection" content="telephone=no"> now which is great. Can you also update it so colons are allowed? In my case I need to add twitter:data1 meta tags

  • Updated the scope of the bug as per #note-5

  • @sagesolutions Please file a separate bug for it

  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

    Thank you for working on this.

    In hindsight I think we should have transparently converted the name of the meta tag from a user entered string to something for the machine name, to avoid situations where meta tag names just don't match the limitations of the machine name logic.

    That said, thank you for the improvements.

    A few minor nitpicks:

         $form['id'] = [
           '#type' => 'machine_name',
    +      '#maxlength' => 64,
    +      '#description' => $this->t('A unique name for this custom tag. Must be alpha-numeric, hyphen, or underscore separated.'),
    
    +  protected function createCustomMetaTag($id, $label, $description, $htmlElement, $htmlNameAttribute, $htmlValueAttribute) {
    +    // Access custom meta add page.
    +    $this->drupalGet('admin/config/search/metatag/custom-tags/add');
    +    $this->assertSession()->statusCodeEquals(200);
    +    $edit = [];
    +    $edit['id'] = $id;
    +    $edit['label'] = $label;
    +    $edit['description'] = $description;
    +    $edit['htmlElement'] = $htmlElement;
    +    $edit['htmlNameAttribute'] = $htmlNameAttribute;
    +    $edit['htmlValueAttribute'] = $htmlValueAttribute;
    +    $this->submitForm($edit, 'Save');
    +    $this->assertSession()->addressEquals('/admin/config/search/metatag/custom-tags');
    +    $this->assertSession()->pageTextContains('Created Format Detection Custom tag.');
    +  }
    

    The pageTextContains() check has the name of one meta tag hardcoded, it should check for the $label.

  • Pipeline finished with Failed
    3 months ago
    Total: 317s
    #408575
  • This would be accommodated in πŸ’¬ Creating custom meta tag Active

  • Status changed to Closed: outdated about 2 months ago
  • πŸ‡«πŸ‡·France musa.thomas France πŸ‡«πŸ‡·

    adding temporary patch allowing colons ":" inside machine name, waiting the relataed issue to be resolved

  • πŸ‡«πŸ‡·France musa.thomas France πŸ‡«πŸ‡·

    Ok it seems there is a problem wiith the config entity to have colons inside theire name. So it would be better if we can split the machine name of config and also the real name of the tag?

Production build 0.71.5 2024