We had the same problem when adding “empoyee virtual folders” to our wiki. We wanted to change the following page structure:
Employee 1 Personal Data Contract Data Training ... Employee 2 Personal Data Contract Data Training ... Employee X Personal Data Contract Data Training ...
We solved this with a dirty, but very effective workaround: first we made unique page names by adding prefixes for employees:
Employee 1 Employee 1 - Personal Data Employee 1 - Contract Data Employee 1 - Training ... Employee 2 Employee 2 - Personal Data Employee 2 - Contract Data Employee 2 - Training ... Employee X Employee X - Personal Data Employee X - Contract Data Employee X - Training ...
We defined our own "tag" to mark the part of the page title that should not appear in the confluence interface:
Employee 1 [hide]Employee 1 - [/hide]Personal Data [hide]Employee 1 - [/hide]Contract Data [hide]Employee 1 - [/hide]Training ... Employee 2 [hide]Employee 2 - [/hide]Personal Data [hide]Employee 2 - [/hide]Contract Data [hide]Employee 2 - [/hide]Training ... Employee X [hide]Employee X - [/hide]Personal Data [hide]Employee X - [/hide]Contract Data [hide]Employee X - [/hide]Training ...
The rest is done using JavaScript-Magic, built in through the Confluence Admin Admin> Custom HTML :
<script>(function() { var expr = /\[hide\].*?\[\/hide\]/g, blacklist = ['textarea', 'form', 'pre', 'script', 'style']; $(document) .ajaxSuccess(hideTextParts) .on('ready', hideTextParts); function isChildOfBlacklistedTag(node) { while(node = node.parentNode) { if (node.nodeType === Node.ELEMENT_NODE && blacklist.indexOf(node.nodeName.toLowerCase()) > -1) { return true; } } return false; } function hideTextParts() { var root = document, walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT, null, false), node; while (node = walker.nextNode()) { console.info(node.parentNode); if (expr.test(node.textContent) && !isChildOfBlacklistedTag(node)) { node.textContent = node.textContent.replace(expr, " "); } }; } })(); </script>
The blacklist ensures that the "tag" is not hidden where you need it to appear. For example, in the title field of the page editing screen and in the CSS editing field in space management. You can go to