Hide TOC section numbers

Joe Wojak April 19, 2013

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

0 votes
Answer accepted
Steffen Heller
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 24, 2013

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

2 votes
m
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 19, 2013

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.

Joe Wojak April 23, 2013

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

Steve Meiers January 13, 2017

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

0 votes
Joe Wojak April 23, 2013

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events