paulmassen / grav-plugin-seo

Manage your site’s meta tags for display in search engine results or social media networks. Create and manage json-ld microdata. Includes an easy-to-use live preview feature.
MIT License
84 stars 21 forks source link

"Undefined index: type" when trying to save page #34

Closed teevik closed 6 years ago

teevik commented 6 years ago

Not sure why this error happens, but when i disable the SEO plugin the error doesn't happen

image

paulmassen commented 6 years ago

Ah, someone else reported this issue. Does it happen on every page ? I suspect the "required: true" attribute to be at fault. Can you try removing this line here: https://github.com/paulmassen/grav-plugin-seo/blob/master/blueprints/seo.yaml#L198

Maybe it will fix the problem

paulmassen commented 6 years ago

Another possibility, is that the blueprint from the plugin has trouble being added to your custom blueprint.

It would help if you could paste your blueprint here.

Thanks!

teevik commented 6 years ago

Yeah removing the required: false didn't do anything, but here is my blueprints: default.yaml

form:
  fields:
    tabs:
      type: tabs
      active: 1

      fields:
        content:
          type: tab
          title: Content
          fields:
            header.title:
              type: text
              label: Page Title
            header.background:
              type: file
              label: Page Background
              destination: "@self"
              accept: 
                - "image/*"
                - "video/*"

home.yaml

extends@: default

form:
  fields:
    tabs:
      type: tabs
      active: 1

      fields:
        content:
          type: tab
          title: Content

          fields:
            header.hero_header_text:
              type: text
              label: Hero header text
            header.hero_sub_text:
              type: editor
              label: Hero sub text
paulmassen commented 6 years ago

hmm, just tried with your blueprint, and I can't replicate the problem. I guess you are running latest grav and admin?

Would it be possible for you to zip and send me your user/ folder?

teevik commented 6 years ago

Yep, here you go user.zip

paulmassen commented 6 years ago

Thanks, it will be helpful!

I'm taking a look right now but it seems like I'm still not able to replicate this. From your screenshot, it looks like the problem happens on Home page, but there is no such issue on my install.

Are you running it locally? php7 or php 5+ ? Any more info would be welcomed!

teevik commented 6 years ago

Huh alright, will check it out and see if i can figure out what's happening. I'm using php 7

renards commented 6 years ago

I could replicate the error :

Hope this helps a bit.

teevik commented 6 years ago

Oh i see, thank you so much!

renards commented 6 years ago

You're welcome :slightly_smiling_face:

I did not test the second solution in detail. I think @paulmassen can say if it has a deeper impact.

paulmassen commented 6 years ago

Good catch @renards !

This was indeed a problem with the blueprint on the seo plugin, on pages that do not use the default editor field. The blueprints target the content field in order to add an id. When there is no content field, it causes some problem apparently. I removed it, as this is only for another feature i'm working on in another branch.

I released the 2.1.6 which should solve this problem all along with some small bugfixes.

Thanks again,

Paul

renards commented 6 years ago

Glad to help @paulmassen and thanks for the explanation !