Support Schema.org metatag

Created on 17 January 2024, 10 months ago
Updated 11 April 2024, 7 months ago

Beta 2 tagged, thanks all

Feature request
Status

Fixed

Version

2.1

Component

Code

Created by

🇨🇷Costa Rica mcortes19

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

Merge Requests

Comments & Activities

  • Issue created by @mcortes19
  • 🇦🇺Australia almunnings Melbourne, 🇦🇺

    Took a quick look today.
    Things to note:

    • It's not really a metatag, it's a script tag with a JSON value, built using metatags
    • It's only injected on page views via schema_metatag_page_attachments_alter
    • The schema results can have breadcrumbs via current_route_match, which will need to resolve in a subrequest, which in turn needs the URL of the entity and fires off extra queries.

    To execute it in a subrequest, it'll need the SubrequestBuffer which is a part of graphql_compose_routes

    So we have a few choices:

    1. Do support breadcrumbs and add the schema LD data via the route() InternalEntity
    2. Do support breadcrumbs via entity canonical URL and add to every entity
    3. Don't support breadcrumbs on the schema

    And just spitballin' some ideas here:

    1. Putting scripts on the RouteInternal feels a bit weird and detached.

    2. I'd prefer to keep the ability to execute a SubrequestBuffer low, it's not an excellent way of doing things. So adding it to every entities metatag prop might allow attacking the schema.

    3. Doable now if we add it to the metatag as something like MetaTagScript and I massage some data around.

    So I'm leaning towards option 3, and stripping out any breadcrumbs from the entity.
    Option 2 is bad juju
    Option 1 is a backup plan to be explored.

    Thoughts?

  • Status changed to Postponed: needs info 10 months ago
  • 🇦🇺Australia almunnings Melbourne, 🇦🇺
  • 🇨🇷Costa Rica mcortes19

    @almunnings yes, I will explore option 3 to expose it as MetaTagScript

  • Status changed to Active 8 months ago
  • 🇦🇺Australia almunnings Melbourne, 🇦🇺
  • Status changed to Needs review 8 months ago
  • 🇦🇺Australia almunnings Melbourne, 🇦🇺

    Hows this...

      node(id: "...") {
        ... on MetaTagInterface {
          metatag {
            ... on MetaTagScript {
              tag
              content
              attributes {
                type
              }
            }
          }
        }
      }
    

    <tag {...attributes}>content</tag>

    <script type="application/ld+json">...</script>

    I've not added any special work around breadcrumbs. I don't really want to enable a subrequest per entity. I don't think thats especially sane. Unsure what to do with that.

  • Status changed to Fixed 8 months ago
  • 🇦🇺Australia almunnings Melbourne, 🇦🇺

    Merged into dev. Prepping for beta2.

    Thanks!

  • Status changed to Fixed 7 months ago
  • 🇦🇺Australia almunnings Melbourne, 🇦🇺
Production build 0.71.5 2024