---
url: 'http://workflows-of-ai.com/blog/automagical-metatags'
title: 'Automagical Metatags'
author:
  name: 'Marcus Johansson'
  url: 'http://workflows-of-ai.com/about/marcus-johansson'
date: '2025-02-10T17:38:58+01:00'
updated: '2026-10-10T12:14:04+02:00'
type: article
summary: 'Fill Metatag fields with AI in Drupal: the Metatag automator from AI 1.0.4 writes a page title and picks the share image from the body.'
tags:
  - 'Marcus Johansson'
  - Workflows
  - 'Drupal AI'
image: 'http://workflows-of-ai.com/sites/default/files/previews/41f722e5ba12789a.jpg'
published: true
og:
  site_name: 'Workflows of AI'
  'image:width': '1280'
  'image:height': '720'
  'image:alt': 'Automagical Metatags'
---
Drupal AI

# Automagical Metatags

Let AI write the page title and pick the share image for your Metatag fields, where tokens are not enough.

  Marcus Johansson

February 10, 2025 · 1 min read

 ## About this video

With the release of the AI module 1.0.4, a Metatag automator was released.

This means that you can use AI to fill out specific metatag fields you might want to fill out using AI instead of tokens.

In the video I take an article copied from CNN and let AI write a page title in slang for a young audience. It also finds the first image in the body and uses it as the metatag image.

## Watch the video

[Watch on YouTube: Automagical Metatags](https://www.youtube.com/watch?v=bvGmWKFtaZ0)

### Video chapters

- 0:00 The Metatag automator
- 0:43 A CNN article as example
- 1:26 Adding the Metatag field
- 1:52 Writing the base prompt
- 3:36 Sub prompts for title and image
- 5:50 Generating the title and image

## Transcript

YouTube's automatic captions, lightly corrected. Click a line to jump to that moment in the video.

### Transcript

- 0:00 hey there Marcus here this is sponsored by FreelyGive FreelyGive pays my salary so I can do open source stuff if you need help with AI reach out to free give they have a lot of experts
- 0:12 including myself if you want to help out with the AI module please reach out to me Jamie from fre GI um today I'm going to talk about the the metatag metatag automator that was
- 0:26 added in AI module version 1.0.4 uh so what this can do is automate uh filling out certain metatag fields that you might not have the structure to fill out via tokens so I'm just going to give example
- 0:43 here I have an article I just copied from CNN uh and what I want to do is one one is to write a title using uh another type of language here that might be specific for some specific social media
- 1:02 and I also want to get this image that happens to be in a big HTML field to actually be the Metatag image if someone shares it on Twitter or Facebook or something like
- 1:13 that um the only thing I have installed here is the Metatag module the AI module 1.0.4 as I said and the AI provider OpenAI in this case but you can use any provider in this
- 1:26 case uh and then you just go to the comp type so we're just using the normal article and we're just going to add a meta type here uh we just call this Metatag and
- 1:39 in here you're going to have enable Ai automats and there is the llm meta tag so we're going to use Advan token because I want to use both the title and the description in this
- 1:52 case um so we have the no title oh let's do here can copy and paste this and body based on the title and the contents so I'm going to do Target it towards uh 15 to 18
- 2:32 year old women in America and us use very um slang slang language yeah I don't know that's a good PR but you get the idea right also extract ract the image URL from the
- 3:03 first image you can find in the content so and then we do title equals this and uh uh content and let's just do some separators here or actually since this is HTML the best thing is actually
- 3:28 to do this using Code block in markup that's something that AI understands very well so what is special here now then is uh so I'm going to use the default Advanced Json mod model which is
- 3:41 the open model so we can go to basic tags or we can go to Advanced and if you add more uh uh Metatag modules you can use those fields here then but I'm just going to do the uh page title so this is
- 3:57 a sub prompt now then that you have to give specifically for this and only the things where you uh write a a setup prompt and Sample promp will actually be created VII
- 4:40 so then you also have to give like a one shot example so it uh uh understands approximately how you want to do it it doesn't have to be about the content you were writing about it should just be a
- 4:52 general uh uh so I'm not the I'm not a Native American as you might see uh and I'm also old so I'm not part of the target group so this example is maybe horrible um and then we
- 5:16 have uh uh let's see here short link next set up image here we go uh let's just try there test jpeg extract the first image you can find inside the content so uh oh one thing that's
- 5:43 important no we're using advanced mode so this is going to be HTML that's all good then and that's basically it we're going to save this go to our content here we can see here even the meta tag
- 5:56 is not well okay so here's the thing this is going to use actually the tokens by default and this works as any other automater if this is filled out whether that's token or something manual it will
- 6:11 just use that but in our case we're just going to remove this because we want to fill out the page title right uh for the image nothing is filled out so now we're
- 6:21 just going to go ahead and save it and then AI will basically start working and hopefully if we go back you have seen it's filled out yo check out K do yeah I have no clue if that's something
- 6:40 good right and it also found the actual image so yeah that that is basically it that's how you can use the uh metatag automator to to use AI to fill out specific metatag Fields using any
- 6:56 context thank you for watching

  Filed under [Workflows](/blog?category=6) [Drupal AI](/blog?category=2)

Parts of this content were produced by AI.

This site has not assessed whether a label is required for this content.

  How was AI used?The video and most of the introduction are Marcus's own, first published on workflows-of-ai.com. AI wrote the subtitle, the summary and the video chapters from the transcript, and the last sentences of the introduction, and corrected misheard names in YouTube's automatic captions.

   Marcus Johansson

Tinkers with AI and Drupal

 [About Marcus](/about/marcus-johansson)[Drupal.org profile](https://www.drupal.org/u/marcus_johansson)[Drupal AI](https://www.drupal.org/project/ai)

## The post in three sentences

AI module 1.0.4 added an automator for Metatag fields. With an advanced token prompt over the title and body, the page title gets its own sub prompt and example, and the image gets one that extracts the first image URL from the content. Fields that are already filled, by tokens or by hand, are left alone, so the title token has to be removed first.