Find and alter confluence pages that not contains ...? - Command Line Interface

Hi!

I'm looking for the command to alter pages in a space that not contains the excerpt macro.

I'd like to add an empty or default excerpt.

I'm not shure if it is possible in a single command. Do i have to get a list of that pages before/as input for the storePage action?

And how to say: not contains excerpt.

Danke!

Matze

1 answer

There are a couple of approaches:

  1. A script to getPageSource to a file, read the file to search for {excerpt} and if not found, update the file to include the empty {excerpt}. Then storePage with the modified file. Do this for each page in the space. I have recently used this approach a site migration and will publish a sample groovy script in the next few days.
  2. If the data to be added is always at the start or end of the current page and you can query the Confluence database, then it is easier - see How to automate adding text to Confluence pages

Thank u Bob for the quick answer.

Now i see the way to getPageSource, modify and storePage.
To find pages already have excerpt will be easy. I'll try it tomorrow.
But what's with the rest, these without?
Have i overseen a way to negate the find result?
Do you mean i have to use sql to get these results? Or will the search parameter (confluence search syntax) do it for me?

Thank u!

Matze

Very difficult to say: NOT ;-)

"NOT excerpt" without any further search criteria...
But I think that will work (it does in confluence search): "type:page NOT excerpt"
I'll try it with your suggestions and the --search param.
TU!

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Oct 24, 2018 in Confluence

Atlassian Research opportunity with Confluence templates

Do you use templates with Confluence? Take part in a remote 1-hr workshop. You'll receive USD $100 for your time!   We're looking for people to participate in a   remote 1-hr workshop...

1,030 views 15 13
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you