-1

We have a requirement to Implement Url Strategy for translated language sites page URL .All website pages are shared and created in master website publication We have an event system that subscribed to the following event that translates URL for language website publication. If I do a Component/Page updated and publish that page, the below subscribed page publish event are triggering and working fine and page file name get translated to respective language using page override name from main Component meta-data information of the page.

public WesiteUrlStrategy() {

        EventSystem.Subscribe<Page, PublishEventArgs>(SetLocalizedPageFileName, EventPhases.Initiated);
                    EventSystem.Subscribe<PublishTransaction, SaveEventArgs>(UnlocalizePageAfterPublish, EventPhases.TransactionCommitted);
        EventSystem.Subscribe<Page, UnPublishEventArgs>(AfterPageUnPublish, EventPhases.TransactionCommitted);

    }

Everything is working fine when I publish a page.

But, when I update and publish a component using CME or XPM , related link pages are publishing and updating as per expectation but subscribe event for Page “PublishEventArgs” is not triggering .

Am I doing something wrong or is this behavior by design?or some other

1

Have you checked the logs? Are you sure that the event is not triggering and is not some error in the function? You could throw an exception in the first line of your "SetLocalizedPageFileName" function to ensure it's triggered.

throw new PublisherException(new LocalizableMessage("Triggered")); 

Also you colud try to subscribe another event like:

EventSystem.SubscribeAsync<PublishTransaction, SaveEventArgs>

and add your logic here

| improve this answer | |
  • @Julian-I have checked log but i didn't find any event system related error.Page Publish event is triggering when i am publishing the page but Page Publish event is not triggering. In case of component publishing for related pages due to this the translated file name changes back to English. – user1920875 Feb 3 '16 at 6:00
  • As you suggested to use <i>EventSystem.SubscribeAsync<PublishTransaction, SaveEventArgs></i> But only getting one item in transaction.Items list i.e publish Component only no related Pages. – user1920875 Feb 3 '16 at 6:03
  • You could try to subscribe the publish transaction once commited and in your function check in the transaction.GetListProcessedItems. If some processed items are pages, then execute your code. The way to subscribe: EventSystem.Subscribe<PublishTransaction, SetPublishStateEventArgs>(YourFunction, EventPhases.TransactionCommitted); Also you could consider to use a custom resolver despite using event system. – Julián Hernández Feb 3 '16 at 11:38
1

A publish event relates specifically to the item you are publishing, and not to other items that are resolved during the publishing process. It is therefore expected behaviour that the event should not fire other than for the item for which the publish is initiated.

| improve this answer | |
0

As per following document, normally, your modified Components in the page is published whenever you select Finish Editing on XPM, this could be the reason that Page publish event is not triggered. To publish a page from XPM, you can navigate to "Manage" tab and click on "Publish" button, this should trigger the Page Publish event. Hope this helps!

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.