0

I have an event on page publish. I want to access the page content(actual HTML that gets generated) that is being published. Is that possible to read the content?

1

In the event system you have access to the Page object and its properties (including its XML), but the rendered content is not a property of the Page object, as that is something which is generated when the Page template code is executed.

If you need access to the rendered content, I would suggest to just do that via a Template Building Block in your Page Template (at the end of the pipeline). Since that is where the rendering actually takes place, and where you will have access to the rendered output quite easily.

Another option is that you move it towards a storage extension, but if that makes sense would depend on your exact requirements and what you plan to do. In any case I don't think the event system is suitable from what you explained right now.

  • I am trying to capture all the URLs refered in a page when a page is published. – user1421 Feb 10 '15 at 11:04
  • Sounds like something you can easily do in a TBB, going over the Output item in the package. – Bart Koopman Feb 10 '15 at 11:20
  • Assuming the URLs are resolved at publish time - if you have dynamic links, then you will not be able to get those at publish time – Will Price Feb 10 '15 at 12:03
  • Why do you need to capture all the URLs? What is the base requirement here? – Will Price Feb 10 '15 at 12:04
  • I am trying to capture the URLs and check if they exist. – user1421 Feb 10 '15 at 12:39

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.