Typically what you do in this case is have a datasource web part on the page and specify the necessary fields (where, page types, order by, etc.). You take note of the datasources name and add that to two repeaters on the page. One repeater is or your anchor link navigation and the other is the actual content you wish to display (link to).
One thing to note, is the anchor link needs to be a URL friendly value. So something with spaces or un-encoded URL values will NOT work.
In your navigation repeater (where you link FROM), you'll need something like the following in the transformation:
<li>
<a href="#faq-<%# Eval("DocumentID") %>"><%# Eval("DocumentName") %></a>
</li>
In your listing repeater (where you link TO), you'll need something like the following in the transformation:
<div class="faq-item" id="faq-<%# Eval("DocumentID") %>">
... your content here
</div>
Reference W3Schools Bookmarks