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 Answer
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.– user1421Commented Feb 10, 2015 at 11:04
-
Sounds like something you can easily do in a TBB, going over the
Output
item in the package. Commented Feb 10, 2015 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 Commented Feb 10, 2015 at 12:03
-
Why do you need to capture all the URLs? What is the base requirement here? Commented Feb 10, 2015 at 12:04
-