Hide TOC section numbers

Hello,

New to Confluence (using on-demand). Working with styling PDF output and I'd like to hide section numbers in the table of contents.

With regular output, the process numbers my sections like this:

1.1.0, 1.1.1, 1.1.2, 2.1.1, etc.

I'd like to remove these completely.

In the advanced PDF instructions, I saw this code. Thought it might turn of section numbering completely:

/* Turn off the default section numbering for this TOC item */
.toclvl0:before
{
 content: " ";
 counter-reset: chapter 0; 
}

However, what this seems to do is start the section numbers with a 0, like this: 0.1.1, 0.1.2.

What can I do to hide section numbers, but keep page numbers in the PDF output for a TOC?

Thanks!

3 answers

1 accepted

Just in case you are interested:

There is another answer to the same question at https://answers.atlassian.com/questions/44440/pdf-stylesheet-any-guides-out-there#75579

Hi,

This did it for me:

span.tocnum:before 
{
    content: target-counter(attr(href), page, decimal );
}

div.toc 
{
    page-break-after: always;
}

div.toc a 
{
    text-decoration: none;
    color: black;    
}

div.toclvl0:before
{
  display: none;
}

div.toclvl0
{
    padding-left: 20px;
    counter-reset: section 0;      /* Set section to 0 */
}

div.toclvl1:before
{
    display: none;
}

div.toclvl1
{
    padding-left: 40px;
    counter-reset: subsection 0;
}

div.toclvl2:before
{
    display: none;
}

div.toclvl2
{
    padding-left: 60px;
    counter-reset: subsubsection 0;
}

div.toclvl3:before
{
    display: none;
}

div.toclvl3
{
    padding-left: 80px;
    counter-reset: subsubsubsection 0;
}

div.toclvl4:before
{
    display: none;
}

div.toclvl4
{
    padding-left: 100px;
}

My CSS skills are not top touch, you probably could have just removed the div.toclv13:before elements and gotten the same result. Or, if you want to allow for backing this out. Comment out what you don't want and put in just the display: none; with a note.

Hi, thank you for the response. That code works for me. Really appreciate the help!

+1 - Works for me too, using Confluence 5.6.3.

Hi, Your code solved the problem. Thanks for the help!

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Tuesday in Uncategorized

Friday fun: how many celebrates Midsummer holiday or is this a Swedish tradition only?

Any other country that celebrates Midsummer holiday (this friday 22 June)?  

36 views 3 1
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