• Resolved altoscameron

    (@altoscameron)


    My response looks like this
    `
    +”yoast_meta”: array:11 [▼
    0 => {#600 ▼
    +”name”: “description”
    +”content”: “Shop page meta description”
    }
    1 => {#598 ▼
    +”name”: “robots”
    +”content”: “noindex,follow”
    }
    2 => {#612 ▼
    +”property”: “og:locale”
    +”content”: “en_US”
    }
    3 => {#605 ▼
    +”property”: “og:type”
    +”content”: “article”
    }
    4 => {#596 ▼
    +”property”: “og:title”
    +”content”: “Shop – Storename”
    }
    5 => {#614 ▼
    +”property”: “og:description”
    +”content”: “Shop page meta description”
    }
    6 => {#615 ▼
    +”property”: “og:url”
    +”content”: “https://myurl.com/shop”
    }
    7 => {#616 ▼
    +”property”: “og:site_name”
    +”content”: “Sitename”
    }
    8 => {#617 ▼
    +”name”: “twitter:card”
    +”content”: “summary_large_image”
    }
    9 => {#618 ▼
    +”name”: “twitter:description”
    +”content”: “Shop page meta description”
    }
    10 => {#619 ▼
    +”name”: “twitter:title”
    +”content”: “Shop – Storename”
    }
    ]
    `

    as you can see the object/array names are inconstant. That means in a foreach loop you have to check if the yoast_meta has “name” or “property” on each.

    To speed things up is there a way to make the array more associative like
    `
    +”yoast_meta”: array:11 [▼
    “description” : “Shop page meta description”,
    “robots” : “noindex,follow”,
    “og:locale”: “en_US”,
    “og:type”: “article”,
    “og:title”: “Shop – Storename”,
    “og:description”: “Shop page meta description”,
    “og:url”: “https://myurl.com/shop”
    “og:site_name”: “Sitename”
    “twitter:card”: “summary_large_image”
    “twitter:description”: “Shop page meta description”
    “twitter:title”: “Shop – Storename”
    ]
    `
    Thanks in advance.

Viewing 1 replies (of 1 total)
  • Plugin Author Richard Korthuis

    (@rockfire)

    Hi @altoscameron

    Thank you for using our plugin!

    Let me explain the structure and why we didn’t make it more associative as you suggest: The name/value pairs are build exactly as the meta tags would have been generated by Yoast SEO. So let’s look at the first item:

    {
        "name": "description",
        "content": "Shop page meta description"
    }

    This directly translates to the meta tag:

    <meta name="description" content="Shop page meta description">

    So as you can see the name/value pairs correspond with the attribute name/value pairs of the meta tag.

    So unfortunately for you we have no plans to change this structure.

Viewing 1 replies (of 1 total)
  • The topic ‘Any change for more direct array response?’ is closed to new replies.