Uncertain about meaning of ID's and UUID

Hi all,

I’m new to Kirby and have installed Kirby 4.2.0 along with Zero One Kirby CMS Theme an a development server (Win, Xampp, PHP8.2) and I’m developing a site to replace www.jever-fan.de.

As my current site has thousands of products, I feel unable to enter them manually, that is to say: I want to migrate them. I exported the data of my existing site and using a self-developed Python Script I am able to create content files, one per product. The displayal looks good, the data also works in the panel.

But I feel uncertain, as the principle of my script is, that a valid content file (created by using the panel) is used as the base and my script just replaces that pieces of content, which are different for the new product.

The consequence is, that I’m using the same ID’s and the same UUID again and again in each and every content file.

Before I’m now starting to produce these thousands of content files I would like to know, whether this will be a problem. Thanks in advance for your replies!

The UUID must be unique, otherwise it’s useless, as the UUIDs are used as references in page sections etc.

It is possible to disable UUIDs in the config, in which case Kirby will use the page ids, which consist of the slugs (folder names) of the path, for example, if you have a parent notes and a child my-first-note, the id would be notes/my-first-note (without any prepended numbers for listed pages)

Thank you Texnixe, sounds great, but how to do it? I do not see settings in the panel. I searched and found an article regarding this topic in this forum. The article is marked solved, but does not say how to do it. Could you tell me please?

You cannot set config options via the panel, see Configuring Kirby | Kirby CMS and Config options | Kirby CMS

Having had a look to the config.php, none of the configuration options look like it would enable/disable the UUID. Would it be possible to have a short phone call, this maybe would be more efficient. I’m also ready to pay for some professional support.

The content file also contains tons of ID’s (e.g. “id”:“5230208f-9de0-406a-951d-16ff45f70fb1”), where I am uncertain, how to handle them when importing content. Another issue is about importing the pictures (see other thread). I’m in contact with the vendor of the theme, but he is sending me over to you.

You can disable UUIDs like this:

// site/config/config.php
return [
  'content' => [
    'uuid' => false
  ]
];

See content | Kirby CMS.

Kirby’s UUIDs can be anything you want, so I’d rather use something unique you already have in your current system instead of disabling them altogether — like the “Artikel-Nr.”.

As for the IDs you mention, I’m pretty sure they are for blocks. They have nothing to do with the page UUID, though.

1 Like

Hi, there is already a return block in the file. I tried to add the code within the return brackets at the end prior the existing closing return bracket (of cause I removed the return [ … ] thing).

And I tried to add the entire block as displayed above below the existing closing return bracket.

Both led to the situation, that the page is not loading anymore at all. I therefore have removed the change.


Thank you for the hint that it is okay, to have own unique values, I will go for this.


The other ID’s (for blocks as you said): is it problem, if I have the same ID’s again and again for each and every content file. I crafted a Python script which can create content files automatically, but want to be sure, that I do not make a bad mistake if I reuse the same ID’s again and again.

Hi @jeverfan, just add it without return statement inside the already available return statement. And make sure to add comma after the closing bracket.

I’m in touch with @jeverfan over email because he is using Zero One as a destination for migration.

He created a very good script which do most of the migration process pretty well.

The only doubt left is how should he handle IDs for Layout sections because he is migrating content from old website to Layout/blocks fields.

I don’t know is there a way to remove automatic Layout section IDs and what would happen if Layout sections are generated directly in the content .txt file without Layout section IDs.

If you create blocks or layouts programmatically, the block/layout ids are assigned automatically.

But must admit that I didn’t quite understand what the script does in terms of overwriting stuff.

Yes, I know, but he is not creating layouts and blocks programmatically, his script (I think Python script) is creating .txt content file with layouts/blocks content. And he can generate everything except unique layouts/blocks IDs.

What I understood what his script does:

  • Create a product folder (for product URL)
  • Create product.de.txt file using already set template content and change content per migrated product content
  • Import images to folder

He is doing that to create a product page:

Now his problem is that he don’t know how will Kirby behave if his script create Layouts/Blocks in content .txt file… without Layouts/Blocks IDs.

No sure what happens if the block/layout ids are the same or non-existent. I would assume that it doesn’t matter if they are the same across multiple content files, but that it does matter if multiple blocks within the same content file are the same.

@jeverfan On a side note, Kirby doesn’t offer phone support. We are a small team and simply don’t have the time, not even when paid.

But I’m pretty sure you can hire someone from the community if need be.

1 Like

I am sure he can set his script to create some unique/random IDs for Layouts/Blocks, but doubt is will Kirby check/validate those script-created-IDs using some rule, or something?

Or Kirby doesn’t care about those IDs after they are created in the content .txt file?

I just tested removing a block id and saving the page again via the Panel. The block was still shown in the Panel, and after making a change a new id was generated. Setting some random string didn’t make a difference either, but then this string is not replaced when saving again.

Also works for multiple blocks with no ids set. I assume the same is true for layouts.

Would have to check the code in detail for possible side effects if no ids are present.

1 Like

Hi Sonja, then probably is the same with Layouts. Great :muscle:

I will summarize everything and write an email to @jeverfan to be sure he understands.

Thank you!

Dear all,

  • mrfreedom described my approach/script very well, this is exactly what I’m doing.
  • I understand, that it is no problem, if I reuse the ID’s in each and every content file as long as I do not have duplicate ID’s in one content file. Knowing this, I will not remove the ID’s and I will not create own ID’s.
  • To come back to the UUID: I will keep it and use own unique value.
  • mrfreedom agreed to change the theme for me, so the images in the directory will be automatically incorporated.

I want to say a very big THANK YOU to all of you. Your help (and my script) will save me at least weeks of work.

And it is absolutely fantastic, that I now can enjoy the flexibility that Kirby and the Zero One theme provide. I’m not good at (web-)design, my strenghts are the content and I can now focus on that what I can and love.

You made not only my day, much more than that. @mrfreedom: please be and remain my partner if I later come the point I need one or two further adjustments! It will not be your disadvantage.

2 Likes

Welcome to the Kirby community @jeverfan, these are just normal things around here!