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

[plugin-seo] minLength and maxLength are referenced from defaults and cannot be changed #8745

Closed
maciej-uxmachina opened this issue Oct 16, 2024 · 6 comments
Assignees

Comments

@maciej-uxmachina
Copy link

maciej-uxmachina commented Oct 16, 2024

[updated with a forked repo]

Reproduction fork
https://github.com/maciej-uxmachina/payload-plugin-seo-length-overrides-issue/tree/beta

Reproduction changes made
maciej-uxmachina@3e42d06

Reproduction steps

  1. pnpm dev _community
  2. Go to http://localhost:3000/admin/globals/LandingPage
  3. Switch to the SEO tab
  4. In the Title field, enter text longer than or equal to 10 characters
  5. Observe the plugin-seo:tooShort is still displayed below the field and the progress bar is still red, indicating there's more characters that still should be entered

Please note in the field config:

MetaTitleField({
  hasGenerateFn: true,
  overrides: {
    localized: true,
    minLength: 10,
  },
}),

P.S. I haven't investigated why translations are not being pulled when testing via pnpm dev _community but it should not prevent reproducing this issue

Expected outcome
The progress bar and all informational texts should reflect the value 10 as the minLength rather than the default 50.

@paulpopus paulpopus self-assigned this Oct 16, 2024
@akhrarovsaid
Copy link
Contributor

akhrarovsaid commented Oct 16, 2024

Hey @maciej-uxmachina,

I'd love nothing more than to help you and the devs in getting this issue sorted. However, it's really hard to do that since you did not follow the standard issue template.

Despite this, I have tried to reproduce your issue with the plugin-seo test folder in the monorepo to no avail. I am able to edit maxLength and minLength for both fields via the fieldOverrides option passed directly into the plugin. Maybe I'm missing something crucial?

Can you format your issue to follow the template and include the relevant information (such as Payload version, adapter version, node version, etc.)? Or, even better, post a reproduction of this issue?

EDIT: Or are we talking about the indicators? If so, then isn't that just a suggestion for optimal seo?

@maciej-uxmachina
Copy link
Author

Thanks for the reply @akhrarovsaid and apologies for not following the guide.
I'll work on the fork that reproduces this issue.

Meanwhile, in case it helps, I isolated this issue to be specifically related to the LengthIndicator and lengthTipTitle. The actual validation (ability to publish a collection for example) does respect the minLength and maxLength overrides.

Here are two screenshots showing the behaviour with minLength set to 10.
In both cases the lengthTipTitle and LengthIndicator show the default minLength of 50, while only the error message shows the correct 10:
Image

Image

Still as mentioned, I'll create a fork to reproduce this issue. Thank you for your support.

@maciej-uxmachina
Copy link
Author

Reproduction fork
https://github.com/maciej-uxmachina/payload-plugin-seo-length-overrides-issue/tree/beta

Reproduction changes made
maciej-uxmachina@3e42d06

Reproduction steps

  1. pnpm dev _community
  2. Go to http://localhost:3000/admin/globals/LandingPage
  3. Switch to the SEO tab
  4. In the Title field, enter text longer than or equal to 10 characters
  5. Observe the plugin-seo:tooShort is still displayed below the field and the progress bar is still red, indicating there's more characters that still should be entered

Please note in the field config:

MetaTitleField({
  hasGenerateFn: true,
  overrides: {
    localized: true,
    minLength: 10,
  },
}),

P.S. I haven't investigated why translations are not being pulled when testing via pnpm dev _community but it should not prevent reproducing this issue

Expected outcome
The progress bar and all informational texts should reflect the value 10 as the minLength rather than the default 50.

@paulpopus
Copy link
Contributor

Thanks for adding a repro!

@paulpopus
Copy link
Contributor

This will be fixed in #8765

It will respect those overrides, for the OverviewField it will have additional override props specifically for these lengths via titleOverrides and descriptionOverrides.

Copy link

This issue has been automatically locked.
Please open a new issue if this issue persists with any additional detail.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants