I am starting to think I have bitten off more than i can chew with this one, but I thought I would put it out there for discussion and hopefully someone like @jenstornell will help me make it a reality
I have been playing around a lot with JSON schema for SEO lately, by using custom fields and a few snippets but its quickly becoming quite the mess of if statements, and JSON schema is a bit fussy with commas, so I’m trying to think of ways to potentially turns this into a plugin.
Essentially, i’m trying put something like this inside Kirby’s panel, so that it picks up on existing fields & data as much as possible.
Just looking for creative suggestions really, on the best plan of attack (this is my first real plugin thats not a cachebuster ).
Ive been through the list of existing plugins to see if i can pull it off by combining some of them, but i don’t think thats going to cut it.
Essentially what it boils down to is being able to set a schema type from a dropdown and then triggering a set of fields based on the selection.
Is it possible to get a field to get a value from a field already on the page, rather setting a value again? Things like title fields and image fields should be reused, I think.
Another way I can think of is that its possible to turn a JSON feed into schema data. Maybe it might be best to just pump the site and page data into a json feed and then read it into the pages as inline schema.
Also, is it possible for a custom field actually contain more then one field? Another way might be to just make a series of custom fields for the top level types, with all the necessary fields inside each one, then store the data in the text file in a similar way to the structurefield. That way i can loop through it. Is that possible?
Why would it be necessary to have such a dropdown in the first place? I mean, if I have an events page blueprint, there is no need to select anything else, I would need some event JSON-LD (or some other Schema markup) or for a blog post blueprint an article schema… Somehow this concept seems to go against the whole idea of blueprints for different templates, doesn’t it? Of course you can show or hide a field set based on a select field, there is even a plugin that does that.
Sure, im just thinking out loud really. If i did it as a drop down, a lot of the choices wont match the context of the page. I’m currently thinking the best way is a series of custom fields for the top level types, so the most appropriate one can be added to the blueprint. Im trying to avoid ending up with a huge pile of fields in the panel that may not be relevant.
Is there?? Is it fairly new? I looked for something that did that a few months ago when working itunes/podcast stuff, and came up blank. Do you happen to know the repo address?
No, its not new, the field uses a radio field as a basis, but that doesn’t really make any difference: https://github.com/medienbaecker/kirby-fieldtoggle
A custom field can contain multiple fields, yes, I they can also be shown dynamically. I just recently created a new field, that lets you add select options: https://github.com/texnixe/kirby-selectplus.
So, you can really do all sorts of stuff.
This is good news. Nice plugin too, by the way
Oh yes, I knew about that one, but thanks.
Sonja has already replied and I don’t have that much to add, but I agree with what was said. As much as possible, try to add the schema directly in the header.php. When it’s not possible use a field you like.
Not sure if you have seen this (a new way of organizing fields): https://github.com/jenstornell/kirby-plugins/projects/1
Anyway, I don’t have time to make any plugins right now. I’m already working on a plugin that hopefully soon will be released.
Wow, great work @jenstornell!