Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extending ImageMedia #18

Open
andrewmarkham opened this issue May 2, 2024 · 1 comment
Open

Extending ImageMedia #18

andrewmarkham opened this issue May 2, 2024 · 1 comment

Comments

@andrewmarkham
Copy link

Hi @remkoj

I am using the code from the 'redesign' branch, so I appreciate that this is still being worked on.

I have extended the type 'ImageMedia' to include a new 'AltText' property to support SEO and Accessibility.

The following query works

query MyQuery {
   ImageMedia {
    items {
      Title
      _metadata {
        displayName
        url {
          type
          hierarchical
          default
          base
        }
      }
    }
  }
}

...but when I place the image directly into a content area the new 'Title' property isn't returned. The fragments in the 'getContentByPath' query don't support the extra property when the items are expanded.

If I take the generated 'getContentByPath', amend it as shown below then it works.

fragment BlockData on IContent {
  ...IContentData
  ...HeroWithImageBlockData
  ...TextBlockData
  ...ImageMediaData // added this new fragment
}

fragment ImageMediaData on ImageMedia {
    Title
    _metadata {
        displayName
        url {
            ...LinkData
        }
  }
}

I think we should be able to extend the built in Image and Video models to support these common properties.

Thanks

@remkoj
Copy link
Collaborator

remkoj commented Aug 7, 2024

Hi @andrewmarkham,

The frontend uses file patterns to decide which fragments must be included in the BlockData, PageData and - in the future, when #22 has been completed - ElementData fragments. The configuration for these patterns can be set in the "injections" section within apps/frontend/codegen.ts.

Can you confirm that the file that includes the ImageMediaData fragment you've created is matched by one of the patterns that would place it in BlockData?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants