Handling duplicate page names

Jay A April 4, 2013

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.

8 answers

2 votes
brainbits GmbH March 4, 2015

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.

mrsolo September 7, 2016

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

Jack [AppFox]
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
November 8, 2016

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

Christian Botved Poulsen July 25, 2017

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

Miroslav Kralik August 7, 2017

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

Petr Spiller September 7, 2017

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

Rick Mellor January 24, 2018

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>

1 vote
SarahA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 4, 2013

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 Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 4, 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 ?

Stefan Kleineikenscheidt _K15t_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 4, 2013

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

Jay A April 4, 2013

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.

0 votes
Marcelino Richarte February 23, 2020

Hey all, we also new to confluence, and sorry to dig up an old post... but is there any setting anywhere to allow page name duplicates ? we have multiple clients and under the same Space we have a few sub entries that will always be the same, and i dont like adding in ClientName or a number before just for it to be unique ?

 

Thanks

0 votes
Stephan Du Plessis October 24, 2018

You can also enter a non-blank-space in the title (ALT + 255), worked for me.

0 votes
kevingvand April 5, 2017

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.

0 votes
Sergey Bondarev January 3, 2017

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.

0 votes
Ben J. January 12, 2015

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?

0 votes
Thomas Schlegel
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 4, 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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events