First 'URL' Field in site.php Blueprint Becomes 'Title'

I need to add a series of URL fields to the default ‘site variables’ template - they should store a list of possible social media links for the client’s various accounts in social networks. In my ‘site.php’ blueprint I’ve added the following field, just before the default copyright field:

facebook-url
  label: Facebook URL
  type:  url

The problem is, in the Panel the field does not display as an URL field: it displays as a title field.

If I add more URL fields to the list, the second, third, fourth, etc. all display as proper URL fields, but the first field always displays as ‘title’. For instance, with this…:

facebook-url
  label: Facebook URL
  type:  url
twitter-url
  label: Twitter URL
  type:  url
linkedin-url
  label: LinkedIn URL
  type:  url

…the Twitter and LinkedIn fields display as URL fields, but Facebook displays as a ‘title’. If I change the order…:

twitter-url
  label: Twitter URL
  type:  url
facebook-url
  label: Facebook URL
  type:  url
linkedin-url
  label: LinkedIn URL
  type:  url

…now Facebook and LinkedIn display as URL, and Twitter displays as title…

Am I doing something obviously wrong, or is this a known bug?

Many thanks in advance for any guidance.

It seems also that my panel is not saving the collected site info appropriately in ‘site.txt’.

I’ve added 7 url fields, as described above. They seem to display fine in the Panel, with the exception of the first field, as described above. Now, if I fill all of the fields with info, and click ‘Save’, in my site.txt file I see numbers instead of field titles for the new info entered:

----
1: 
----
2: 
----
3: 

Of note:

  1. although I’ve entered 7 new fields in the blueprint, only 6 fields (numbers 1-6) show up in site.txt on a first save
  2. the information on the panel fields is not actually saved, except for the last 2 fields
  3. upon saving again, more fields with numbers are added to site.txt - up to 12, 18 and so on…
  4. only information in the last 2 fields seem to be saved, regardless of how many times I enter and re-save it.

I have also tried manually editing site.txt, so that it contains the same fields as described in the site.php blueprint. I’ve also tried adding adding information manually to site.txt, to see if it is reflected in the panel. It isn’t. And entering information in the panel, and saving it, over-writes the new fields in site.txt, and we end up with numbered fields again…

Finally, I tried changing the field type of all 7 fields from ‘url’ to ‘text’. Unfortunately, the same problem happens: only info on last 2 fields is saved, fields are numbered and not named in site.txt, etc.

I feel like I must be doing something fundamentally wrong, but can’t work out what it is…

Any help would be greatly appreciated.

Are you using the Kirby 2.1 beta? I briefly tested this on a fresh plainkit install and had the same problem. Even more weird, in my installation it adds a new numbered field to the blueprint every time I hit the save button and the one entered url moves up and down in the form fields … Sounds like a bug to me.

Thank you for the feedback - it’s good to know I’m not going crazy!

I’m using the ‘official’ starterkit from the getkirby website. I believe it’s version 2, not the 2.1 beta.

Is the ‘plainkit’ a different download to the ‘starterkit’, or are they the same thing?

The plainkit and the starterkit should be the same as regards the Kirby/Panel core, the only difference that I know of is that the starterkit contains some example content and css while the plainkit does not.

Really happy to be able to report that this bug seems to be fixed in the current 2.1 beta! Yay!!! :smile:

At first: the kirby panel needs a title field. Do you have one in your blueprint?
Second: I think there are some colons missing. Try something like this:

fields:
  title:
    label: Title
    type:  text
  twitter-url:
    label: Twitter URL
    type:  url

As seen in http://getkirby.com/docs/panel/blueprints.

Does this fix your problem?

@jbeyerstedt thank you for chipping in. As explained previously, the blueprint we’re talking about here is the “site.php” blueprint that allows you to specify site-wide values and defaults. In the standard Kirby v2 instal it already has a ‘title’ field - as well as others - but whatever custom field you add to it gets converted to a second title field.

I believe this must have been a known bug, because it seems to have been corrected in v2.1 beta. :smile:

I´m using v2.1 beta as well. But you have to add some colons to the fields name. Write field: instead of field.
So your code should be:

twitter-url:
  label: Twitter URL
  type:  url
facebook-url:
  label: Facebook URL
  type:  url
linkedin-url:
  label: LinkedIn URL
  type:  url

I don´t think that tis is a bug, because your syntax was wrong. Can you please check if it works with these changes.

@jbeyerstedt You are absolutely right, I just copied @luxlogica’s code and completely overlooked the missing colons :unamused:

Guys, indeed the code I typed here was missing colons after the field names. My actual file was not like that, and that was not the issue. As mentioned previously, whatever the issue was, it has been fixed in the 2.1 beta.

Sorry, but I tried you code, which lead to weird field behavior.
Then you were right.

I should have been more careful with my posting - sorry! :blush: