strapi-plugin-seo icon indicating copy to clipboard operation
strapi-plugin-seo copied to clipboard

Feature request: Prefill the seo fields based on the fields of the page

Open boazpoolman opened this issue 1 year ago • 4 comments

Feature request

Summary

It would be nice to have the seo fields be prefilled based on the data of the page. So for example the seo title would be prefilled based on the actual title of the page.

Why is it needed?

Because the page title and seo title will often be the same. So it makes sense that you would have to input it just once instead of twice. This also makes it easier to update the title in the future. As you would only have to update it once.

Suggested solution(s)

Have an interface on the settings page of the plugin where you can set how the fields should be built up. So for example for the seo title I can select the title field of the content type to have that be used to prefill the seo title.

It would also be cool if we can inject some extra text. So my seo title could be build up by giving the plugin a string like Strapi | [title] where [title] will be replaced by the actual title of the page.

Related issue(s)/PR(s)

None that I know of.

boazpoolman avatar Sep 21 '22 16:09 boazpoolman

@boazpoolman Unfortunately, it won't be done, check this issue.

SalahAdDin avatar Oct 08 '22 16:10 SalahAdDin

In fact, automatically filling fields from other fields is not something we encourage you to do at Strapi. However, I will definitely think about a way to import the content of another field as the UID does! Will work on that during the month of November

Mcastres avatar Oct 10 '22 12:10 Mcastres

I've would suggest let user define some custom controller function or service for that. Like if entry is saved you can call this function from seo ui panel via button.

So basically you can have something like:

interface CoreServiceWithSeo extends GenericService<T> {
  seo: (ctx) => Promise<Partial<SeoComponetType>>;
}

export default factories.createCoreService<CoreServiceWithSeo>('api::bla.bla', ({ strapi }) =>  ({
  async seo(ctx) {
    ...
    return { ...data }
  },
});

And let user decide how to handle this if he want, prolly can assemble a PR for that, with proper types handling...

antokhio avatar Jul 01 '23 10:07 antokhio

In fact, automatically filling fields from other fields is not something we encourage you to do at Strapi. However, I will definitely think about a way to import the content of another field as the UID does! Will work on that during the month of November

One year ago, no signs of this development.

SalahAdDin avatar Jul 22 '23 00:07 SalahAdDin