NaN is displayed in excerpt include

Will Wang February 18, 2019

I insert one excerpt macro and embed one HTML macro into it on page A, the excerpt displays the value of HTML macro(550) correctly on page A; On page B, I inserted on excerpt include to include excerpt on page A, but it shows NaN on page B, BTW,the value has been transferred to string format, I also tried to output the value direct in JS but it is not available in JS currently after checking(if you know a way to do so, be sure to tell me, thanks in advance). Here attached screenshots of page A and page B for details. 

 

Page A with excerpt:

Page A with excerpt.PNGPage A outcome:

Page A outcome.PNG

Page B outcome:

excerpt include outcome on Page B.PNG

1 answer

1 accepted

1 vote
Answer accepted
Will Wang February 18, 2019

Woops, I find the root cause, the HTML macro is executed on Page B. 

Any way to limit HTML macro to be executed on page A only ?

Zak Laughton
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 19, 2019

Hi Will,

There's not a native way in Confluence to prevent the HTML macro from being run in an excerpt macro, but there may be a workaround with Javascript. I'd try wrapping the logic in a conditional statement that checks the title of the page.

For example (have not yet tested):

const pageTitle = document.querySelector('#title-text a').innerText; // Get title of page
if (pageTitle === "My Original Page") {
// Insert logic here that you only want on "My Original Page"
}

I hope this helps!
– Zak

Will Wang February 19, 2019

Hi Zak,

   Noted with thanks. But I also need to get the table of source page(Page A).

  i have choose solution that use load() formula in page B to get the data on Page A and get everything done in page B. Below is one sample of load()

 

$("#title-text").load("URL tbody",function(response){

insert the logic here

});

Like Zak Laughton likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events