Handling duplicate page names

I have a requirement to have sub-pages within a space that have duplicate page names. Unfortunately, Confluence won't let me do that.

How are others handling this? Is there a way around it?

For example, I may have 2 top level pages which are named with a client name, and a sub-page under each one that I want to call "Findings and Recommendations". I know I could move this up to the Space level and keep a space for each client, however, I'm using the spaces for each team within the company. And because it doesn't allow nested spaces, this is the only way I can do it.

6 answers

This widget could not be displayed.

We had the same issue when adding "virtual empoyee folders" to our wiki. We wanted to build 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 it with dirty but - concering our special needs - very effective workaround: first we made the page names unique by adding employee-specific prefixes:

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
...

The we defined our own "tag" to mark the part of the page title that should not appear in the confluence frontend:

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 by a little JavaScript-Magic, that is embedded via **Confluence Admin > Custom HTML**:

(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, " ");
                }
            };
        }
        
    })();

The blacklist ensures that the "tag" is not hidden where you need them to be shown. For example in the title field of the page editing screen. You may want to extend the list for your specific needs.

I see three sections in Custom HTML, and the script shown is just displayed in the page. Can you please elaborate. I'm new to confluence and scripting

You just need to wrap the script in <script></script>.

Is this workaround still usable in Confluence 6.2.3 ?
We have just tried and it did not seem to work.

It does not work for me neither in v5.10.8.

Hi, anybody had any success using the script in 6.4?

It looks like there was some copy/paste errors in brainbits' original post.  Here's a working version using Confluence v5.8.8.  Sorry for the lack of formatting.  It's not working for me and I don't want to spend the time to figure it out.

 

<script language="javascript">
(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>

This widget could not be displayed.

Hallo Jay

One option is to use the Scroll Versions add-on:

https://marketplace.atlassian.com/plugins/com.k15t.scroll.scroll-versions

It allows duplicate page names, as one of the plugin features.

Cheers, Sarah

Thomas Schlegel Community Champion Apr 04, 2013

wow, a plugin that costs nearly half the price of confluence itself. Is this really necessary ? If I would buy all the plugins to get the functionality I would expect from Atlassian, I would have to pay a real big amount of money. Where will all this lead to ?

Thomas, Scroll Versions is not only about duplicate page titles at all. Instead it truns Confluence into a full-fledged solution for wiki-based documentation, with many more features like version management, publishing to other spaces, managed content reuse, etc. (have a look at the screencasts here: http://www.k15t.com/software/scroll-versions/overview)

Compared with other documentation solutions the price is rather inexpensive - at least that's what we hear from most of our customers who transition to Confluence+Scroll Versions for documentation.

Cheers,
-Stefan

Does it really allow duplicate page names? Or does it only allow duplicate page names if they are in different versions?

I see it has some enhanced content reuse features, which is interesting. However, it still doesn't have what I need. I need two things right now:

1. Ability to have duplicate page names within a space. It does NOT have to be at the same tree level under the same parent page. It's not clear in the video or documentation if this is possible without doing a bunch of unneccesary version control voodoo.

2. The ability to include content, but when including it, basically have it paste into my document so I can modify it to be unique for the particular document I'm working on. My reusable content is essentially templates that I fill in with information. If there's a better way to do this, then I'm all ears.

This widget could not be displayed.
Thomas Schlegel Community Champion Apr 04, 2013

Hi Jay,

I think there will be no other solution than renaming the pages to "Findings and Recommendations for Client A", "Findings and Recommendations for Client B" etc.

Atlassian stated here that they will not change this behaviour.

Cheers

Thomas

This widget could not be displayed.

Are there any new answers for this question? I'm have the same request but slightly different context:

I want to create a Release Notes space that contains release notes for each release. 

I want to use the same topic/page names for each release, for example, Bug Fixes, What's New, and so on.

I want to search only Release Notes across multiple releases.

Are there other answers or solutions to this problem besides what has been described so far under this question?

This widget could not be displayed.

I've added spaces in pages with multiple words =) it displayed as one space, but have different names and links. It looks crazy,but works.

This widget could not be displayed.

I managed to solve this issue on a dirty way by making use of the invisible seperator: "⁣" (https://codepoints.net/U+2063). You will not be able to tell the difference, however the link will be changed from "/<SPACE>/<PAGE>" to "viewpage.action?pageId=XXXXXX". In my case this was not a problem.

Suggest an answer

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

Why start from scratch? Introducing four new templates for Confluence Cloud

Hi my Community friends!  For those who don't know me, I'm a product marketer on the Confluence Cloud team - nice to meet you! For those of you who do, you know that I've been all up in your Co...

479 views 6 6
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you