Embedded links with page number
This section explains how to create a page that includes embedded links with page numbers for PDF export.
For more information, see the following:
Before you begin: Use the following page hierarchy.
1. Create or modify a custom stylesheet using the following CSS code:
content: "("target-counter(attr(href), page, decimal)")";
2. Create a user macro with the following example settings.
#if ( $renderContext.getOutputType().toLowerCase() =="pdf" )
#set($outputHtml= $body.replaceAll(">.*</a>","></a>").replaceAll("<a href=", "<a class='embedded-page-link' href="))
#set($outputHtml = $body)
Follow these to create a link on the Embedded link Home page that links a table at the Another page in the export page.
1. Edit Another page in the export and add an Anchor tag to the table:
2. Edit Embedded link Home and insert the user macro here:
3. Add a link to the Link field with the page name and the anchor's name:
- Link text: Any text what you want to see on the page.
Result: You setting should look like this:
- 1.Go to your first exportable page (which in this case it is "Embedded link Home").
- 2.In the page menu click on Export to PDF.
- 3.Customize for this export.
- 4.Click on Stylesheet (CSS) → Edit.
- 6.Click on Apply to save your settings.
- 7.Select content as desired.
- 8.Click on Export.
You can change the text on your Confluence page by changing the Linked text in the user macro's editable field.
You can change the exported text in the PDF by changing your Custom CSS Style (the export result is (<page number>)).
Here are some examples on how you can do that:
content: "See on page: " target-counter(attr(href), page, decimal);
content: "Check " target-counter(attr(href), page, decimal) " page.";