I need to create a custom token for a custom content type in Drupal 8.

there is a field, e.g 'field_image' I'm trying to use Token Custom module to pull the value of the filed and into the token.

The token itself is used in the 'Metatag' module to provide a value for an OG:image

this means that the Content-type needs to assign the image name into the token so that when the content is viewed, the image URL appears in the property.

I have no idea where to start on pulling this value from the field, I've looked at field_tokens module but I'm not sure where to start with this one.

The Custom Content type is from a third party module that I have no control of its development but I can develop for D8 no problem.

Does anyone have any ideas?

Many thanks

  • Any reason you can't use the standard node tag? Here's how we pull the featured image field from our blog pages into og:image, [node:field_featured_image:half_page:url] (half_page is image style) – CG Monroe Mar 14 at 22:01
  • Have not seen that but will give it a shot, thank you – JimmyBorofan Mar 15 at 9:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.