Duplicate a page in the panel in Kirby3

Is it possible to duplicate a page in the panel? I guess i need a custom field with a button to achieve it. Is $page->hardcopy() the way to go?

That would be better off in a custom section, not a field, as it is not supposed to store anything in the page.

And no, not hardcopy (that creates a clone), you have to create a page ($page->create()).

Can i found some documentation about that, with some lines of code to get started please?

https://getkirby.com/docs/reference/plugins/extensions/sections

Is there a simple way to create a new page ($page->create()) with the content and structure of an existing page? What is the best way to do this?

1 Like

Maybe as child of another page?

If you want to duplicate a page from a section, it would probably be best to create a custom section with an option to copy a page from the drop down (where you currently select changeStatus etc.).

Another option you could test is @bnomei’s Janitor plugin with a custom job.

I know how to make a custom section with a button, but I think i will have to look in php for some code to copy/paste a specific directory and content. Seems not possible in Kirby, or i don’t know how :slight_smile: Thanks anyway.

1 Like

In the older versions of Kirby, duplicating a page was as easy as installing a plugin. Do none of these plugins work anymore? The methods above seem to be beyond my cap. Has anyone successfully implemented this function? If so, could you tell me how?

Do you have an example of these Kirby 2 plugins?

Yes:



1 Like

Just re-floating this topic, because I really could use a ‘duplicate/clone page’ function right now… Has anyone created a plugin for K3 yet?

Duplicate functionality is coming to 3.2.

1 Like