Directus Labs SEO Plugin - How to bulk trigger Meta Title and Meta Description Generator via Flows or Otherwise

Hello,

I’m referring to the Directus Labs SEO Plugin. How do I “Generate From Template” in bulk via flows or otherwise for the SEO fields?

Jay

Great question. This “Generate From Template” functionality only works from the interface itself, not via Flows or the API.

You could definitely setup a flow that allows you to do this automatically or in bulk, triggered manually.

Hi Bryant,

Are you saying that I would create my own “template” in the flow itself and update the SEO data directly? Or is there a way to trigger the “Generate From Template” functionality directly? I understand that I can write a flow with it’s own template generation scheme but I was wondering if I could trigger this directly and save some time.

Thanks for the help.

Jay

Currently, the “Generate From Template” functionality cannot be triggered anywhere but when using using the SEO Interface inside an item.

So yes, you’d have to create your own Flow with your own logic and update the SEO data directly. You could potentially pull the template string that’s setup from the directus_fieldsyour_seo_field_nameoptions if you really wanted to, but it’d probably be easier just to create the template over again at that point.

I can see value in having a better toolset for updating in bulk.

Mind to open up an issue for this so we can track it?

@bryantgillespie I was about to create an issue for this, but now I’m questioning whether it’s actually necessary or worth pursuing. How would the extension even work, anyway? :grinning_face_with_smiling_eyes:

My initial thought was that it could be a flow step that takes the item’s key ID, detects (or is configured with) the SEO field to update, pulls the corresponding template, and generates the output. It would also need a way to let the user select which generator to trigger, since not all workflows will want every field updated automatically, especially when preserving manual overrides.

That said, I ended up just creating a simple update step and formatting the JSON the same way the SEO plugin does. It worked fine.

Given how busy the Directus team is, maybe this one’s better left alone. :sweat_smile:

But just in case, here’s my draft. If you feel like it’s worth posting, I will. But after talking it through, I was able to build the flow using regular templates, and it worked great!

I propose a Flow Operation as part of the SEO Plugin bundle, that would allow the triggering of the templates that generate the SEO fields such as title, meta description, etc.

It was discussed here:
https://community.directus.io/t/directus-labs-seo-plugin-how-to-bulk-trigger-meta-title-and-meta-description-generator-via-flows-or-otherwise

The Flow Operation would receive a key id for the item to be updated, as well as the name of the SEO field that should be updated, would pull the data from directus_fieldsyour_seo_field_nameoptions and then update the specified SEO field with the generated template.