Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Bulk find and replace of text within Markdown macro container throughout the whole space

Hello,

We are using Markdown macro on Confluence pages to extend page functionality. Within these macro we use some HTML code patches that allow us to add some custom formatted admonitions, information banners and likes. 

I want to replace some text in bulk within these macros. For example, within these instances of Marcdown macros I have links like <a href="https://example.net/pages/viewpage.action?pageId=12345"></a> and I need them replaced with <a href="https://example.net/pages/viewpage.action?pageId=98765"></a>.

I have administrative access to this instance. 

I am using PgAdmin and the following clause to update the 'bodycontent'  table that as far as I know contains the page content published in Conflence:

UPDATE bodycontent SET body = replace(body, 'example.net/pages/viewpage.action?pageId=12345', 'https://example.net/pages/viewpage.action?pageId=98765') where contentid = '2552552';

This works perfect but only when the content I replace is outside the Markdown macro.

If I add the https://example.net/pages/viewpage.action?pageId=12345 link within the text body of a Confluence page, the above replacement clause works fine. After purging Confluence cache and updating the page with pageId=2552552 I see the changes have taken their place and the new https://example.net/pages/viewpage.action?pageId=98765 address shows on the page.

 However if the same text that I want to replace resides inside an instance of a Markdown macro contained on the page, the replacement clause does not affect the page

That's what I do step by step.

1. Execute the clause:

UPDATE bodycontent SET body = replace(body, 'example.net/pages/viewpage.action?pageId=12345', 'https://example.net/pages/viewpage.action?pageId=98765') where contentid = '2552552';

2. Check that it worked on the table by executing following:

select * from bodycontent where body like '%https://example.net/pages/viewpage.action?pageId=98765%' and contentid = '2552552';

This clause ALWAYS returns the result with the target https://example.net/pages/viewpage.action?pageId=98765. So it feels as if updated worked fine.

3. Clear cache on the /cache/showStatistics.action page.

4. Update page in browser.

Nothing. Nada. Ni suquiera un caracter.

It feels like update works fine. And data in bodycontent does in fact change. However, when you refresh the page, the Markdown macro fetches its old data from some other table. In other words, it feels like when you update the target page in the browser, Markdown macro updates the bodycontent table and overwrites changes made to it with UPDATE clause.

What could be the issue here? Any clues? I need to do nearly 1K+ changes on Confluence pages, and doing it manually really makes me sick.

Thank you.

Stan. 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Confluence

What do you think is the most *delightful* Confluence feature? Comment for a prize!

- Create your own custom emoji 🔥 - "Shake for Feedback" on mobile 📱 - An endless supply of GIFs via GIPHY 🤩 Is there anything quite as nice as a pleasant surprise? Comment below with what...

494 views 24 9
Join discussion

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you