function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Pooja Bhatt 3Pooja Bhatt 3 

Page numbers in tables of contents should be generated automatically

I am using Visualforce page and i want table of content(index) with page number.

i am using the below code but i am not getting page number.
or is there any other way to do the same?

in vf page for index:
<nav>
<ol>
<li class="bodymatter "><a href="#intr_01">Introduction</a></li>
<li class="bodymatter"><a href="#chap_01">Chapter One</a></li>
</ol> </nav>

vf page with content:
<h1 id="intr_01"> Introduction</h1>
<p>some logic</p>
<h1 id="chap_01"> Chapter One</h1>
<p>some logic</p>

CSS:
.bodymatter a::after { content: leader('.') target-counter(attr(href url), page, decimal) }

Result expected:
Introduction.........1
Chapter One...........2
EllEll
First thing to consider is your CSS needs to be loaded into the VF page as a seperate file - you can't apply Page CSS attributes in-line in VF pages.

Your CSS looks correct, this is what we use for our doc-gen product Weaver:
ol.toc a::after { content: leader('.') target-counter(attr(href), page); }

Which looks pretty much the same, so might just be due to what I mentioned earlier with loading in CSS as a seperate file from say, Static Resources.
 
Pooja Bhatt 3Pooja Bhatt 3
still the result is same
User-added image

Result expected:
Introduction.........1
Chapter One...........2
VennelaVennela
Hi, I am looking for similar output, did you end up fiding answer to this??