I wasn't sure how to search for this as I'm not sure what's it's called. Apologies if this is a duplicate though.
Sometimes when I open a PDF, the sidebar will list the table of contents and I'll be able to jump to a section or subsection by click on it's title in the pdf viewer's sidebar. Example:
Other times, when I open up a long pdf, all I see in the sidebar are just the pages, listed in order, but with no other sort of organization. Non-example:
How do I construct my paper so that it works like the first example?