Newspublisher question

Dear Bob Ray,

Ive a question according to Newspublisher 2.1.
Ive added the duplicate button ( &duplicatebutton=1) which does not work well for me because of a pagetitle issue:
The pagetitle for the new docs should always stay the same but it is connected seo friendly url which doesnt allow duplicate urlnames of course.
Normally my newspublisher creates docs with 8digit-numbers which are no problem for friendly urls instead of taking the pagetitle so Im wondering why it takes the pagetitle by duplicating the doc.
Is there any workaround? I have that in a running system with lots of content.

Thanks for your help,

I’m afraid I don’t understand your question. The “Duplicate” button creates an exact duplicate and shows it to you in NewsPublisher so you can edit any of the fields (including the pagetitle).

I’m not clear on exactly what you would like it to do.

Thats absolutely clear.
But the thing in my case is that the exact same pagetitle is needed on all the duplicates.
So if I have a pagetitle “test” in original, the seo name will be test.html.
When I duplicate the post and have to keep “test” as pagetitle, it will be again test.html and that url is not accepted twice. So Im looking for a workaround.

Have you tried changing the allow_duplicate_alias System Setting?

No, because I think this will cause trouble when I have 2 or more pages with the exaxt same name?
The newspublisher ressources are all saved in the same directory …

It sounds like you want duplicate pagetitles but different aliases.

If that’s it, you can add the alias field to NewsPublisher and put whatever you want in it.

Or maybe I’m still misunderstanding you.

No, you’re understanding correct.
But is there another work around to prevent user to put in an alias?
Because of usability … alias is more technical stuff and I dont want to stress ppl with that …

Not that I’m aware of. There is the auto-alias setting, but that would give you a duplicate alias.

It’s possible to create some JavaScript that would populate the alias field when the pagetitle is filled in, but to avoid duplicates, it would have to call a custom processor to see if the alias already exists.

Possibly upon duplication have a lightbox or step in the process ask the user for a ‘unique name’ for new template, and then check the name against the aliases in the tree…

Or, yeah find some way to create one automatically, all that is needed is to add 3 random numbers to the original alias…but it would still need to check for availability or an error is possible, and those numbers won’t help SEO

@sspind something like making a new alias out of the user’s username and the original alias would at least limit the possibility of duplicate alias

This is an interesting problem. Clearly the new alias has to be guided in, as we don’t just want randomness, but then we must check for dups…

It occurs to me that NewsPublisher calls the resource/create or resource/update processor when you save a resource. Both of those fire the ‘OnBeforeDocFormSave’ and ‘OnDocFormSave’ events.

If you can figure out what you want to do for the alias (e.g. add username, hashed username, current time and/or date, PHP’s uniqid(), etc.) , you can do it in a plugin attached to one of those events. All resource fields are available there and the resource object will be available as $resource.

1 Like

Thanks so much for your help!

1 Like

I’m glad I could help. :slight_smile:

1 Like