I want to add a cross reference using :ref: directive in Sphinx to a header in a specific file. The problem i have is that multiple RST file have similar heading structure so the headings are duplicated. So i have tried to get the :ref: work with autosectionlabel and i am having issues.
This works 'refer to my section <my_page.html#my_section>' where I have my_page.rst with the section header my_section.
However when i say :ref:'my_page:my_section' I get WARNING: undefined label
To make sure i have the correct relative path to my_page.rst, i also tried :doc:my_page and that works, so at least i know that :doc: works and the :ref: is not working
I looked through the answers here and i found this link Adding a cross-reference to a subheading or anchor in another page but the answers are not working for me.