How not to duplicate all fields

when a page is duplicated all fields values are duplicated. this causes an issue for my autoid plugin. since the autoid field is copied and not refreshed.

  • is there an option to block this in the blueprint? like for the translation?
  • does a post duplication hook exist on the new page?

Yes, there are two new hooks, page.duplicate:before and page.duplicate:after. Missed adding them to the docs… (Edit: I’ve added them)

I don’t know, but you should be able to take care of this with the page.duplicate:after hook by overwriting the autoid field with a new value.

2 Likes

the docs do not specify this: are the hooks called on the new, old or both pages?

I thought I had given them names that indicate what is what:

The first parameter for the before hook refers to the original page. The parameter for the after hook to the new page.

That’s why I recommended the after hook, because there you have access to the new page object.

2 Likes

@texnixe you are right. i only checked the page.duplicate:after hook and was unsure whats what. but now i know. thanks.

Hi @bnomei,
i am using your autoid-plugin 2.7.7 in a structure-field within site.yml in K3.5. Thank you for that!
Unfortunately i also have an issue with the same autoid on duplicate a structure-item. The autoid is the same :frowning:
Because i query/fetch that structure in a select-field by its autoid-value, i am not able to duplicate, otherwise the list is wrong.
Any idea how to fix that?
Thx, Dennis

hi @dennisb. i created a issue same autoid on duplicate a structure-item · Issue #70 · bnomei/kirby3-autoid · GitHub and will take a look at it asap.

1 Like