Forums

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

How to bulk delete blog posts?

Susanne B August 22, 2019

Hello!

I want to delete blog posts from a space. In my particular case, I can delete all, but it seems better to delete only posts that are older than a selected date.

I'm looking forward to tips.

Greetings Susanne

3 answers

2 votes
Teodora V _Fun Inc_
Community Champion
August 22, 2019

Hi @Susanne B 

What comes into my mind first is creating a page (e.g., Posts for Deletion) and reordering all posts which you want to delete as its child pages. Then remove the page and in the pop-up window check the "Also delete child pages" mark. 

This may work if you have dates in your blog post titles to sort them out while reordering :)

Andy - PTC Redundant
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.
August 22, 2019

Ironically I love this answer because my personal blog posts are per month & year which makes deleting old data quick and easy ! 

Teodora V _Fun Inc_
Community Champion
August 22, 2019

Yes, exactly! :) Order is King!

Like Andy - PTC Redundant likes this
Susanne B August 22, 2019

Thanks for the quick reply.
Moving the posts would also only go individually and not collected at once, wouldn't it? So that I have to open and move or delete all posts one after the other.

Thanks anyway.

Teodora V _Fun Inc_
Community Champion
August 22, 2019

Use the Space tools - Reorder pages menu. It will lead you to the page tree, where you can drag n drop the posts. Attached you can see my personal space, for example in Reorder Pages mode. If I want to delete my Articles folder, it will bulk delete the blog posts also.

 

Screen Shot 2019-08-22 at 4.37.20 PM.png

Susanne B August 22, 2019

I especially want to delete blog posts, they are not displayed in the page tree and can therefore not be moved by drag&drop.

Is there an option which can be activte for display blog posts in the page tree?

Teodora V _Fun Inc_
Community Champion
August 22, 2019

Oh my, I understand your case, I made a few sample pages in my Blog section and try to reorder them. What I suggested was possible if the content is in your main Confluence space. 

There is a feature request from 2004 for bulk-type operations with status "Probably Never". :( 

Found some articles in the documentation space:

https://confluence.atlassian.com/confkb/how-to-bulk-delete-blogposts-of-a-confluence-space-manually-from-confluence-database-using-sql-commands-849065514.html

https://confluence.atlassian.com/doc/blog-posts-834222533.html

Apparently, the manual option is still deleting the posts one by one. Hope someone will have a better solution than me.

Like Josh Carpenter likes this
Susanne B August 22, 2019

It's just that Confluence is designed to capture information and not to delete it. So that I will proceed manually first. Now I don't want to work directly on the DB, maybe when I'm better at the topic.
Thanks anyway!

1 vote
Vincent de Regnauld de Bellescize
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 4, 2022

Hello there,

We were able to successfully delete all blogposts from a space with a groovy script and a CQL query (requires Scriptrunner, use console).

Hope this help.

import com.atlassian.confluence.pages.PageManager
import com.atlassian.sal.api.component.ComponentLocator
import com.atlassian.confluence.core.DefaultDeleteContext

import com.onresolve.scriptrunner.canned.confluence.utils.CQLSearchUtils
import com.onresolve.scriptrunner.canned.confluence.utils.CQLSearch
import com.onresolve.scriptrunner.runner.ScriptRunnerImpl

def pageManager = ComponentLocator.getComponent(PageManager)

def cqlSearchUtils = ScriptRunnerImpl.scriptRunner.getBean(CQLSearchUtils)
def cqlQuery = "space = 'YourSpaceKey' and type = blogpost"
def cqlSearch = new CQLSearch()
def pages = cqlSearchUtils.searchForPages(CQLSearch.fromQuery(cqlQuery))

pages.each{ pageToDelete ->
        pageManager.trashPage(pageToDelete, DefaultDeleteContext.DEFAULT)
        log.error pageToDelete
}
0 votes
Andy - PTC Redundant
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.
August 22, 2019

@Susanne B : Sadly there is no standard "search => criteria:<date // delete" function.

But... it's Server, so how hardcore do you want to get??  A macro could be written if your Atlassian Admin / Development team are up for the challenge:

https://developer.atlassian.com/server/confluence/

Susanne B August 22, 2019

I hoped that Scriptrunner would provide me with a suitable built-in script like the one that deletes obsolete comments on pages. Unfortunately no.
We may find someone in the development who feels called to do so, but the requirement probably doesn't come often enough.
Thank you very much!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events