Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How do I programatically get the content of a page?

Brian Sung October 16, 2018

I'm trying to create a user macro that will search a page's contents and replace certain keywords with whatever is passed into the body of the user macro. Figured I would need to be able to parse the page's contents, but I'm not sure how this is done. Any help would be appreciated!

1 answer

1 accepted

1 vote
Answer accepted
Bill Bailey
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 18, 2018

You may be able to try $content which gains you access to ContentEntityObject, so something like this may work.

$content.getContainerContent()

 The other method that might be easier is to just wrap all the content you want search with your macro, that basically all of the content is accessible via $body. Then you are free do all your substitutions and render as you see fit.

Brian Sung October 19, 2018

Thank you Bill, this is exactly what I needed!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events