ros2_documentation icon indicating copy to clipboard operation
ros2_documentation copied to clipboard

Link to the API in the examples

Open EmmanuelMess opened this issue 10 months ago • 8 comments

I think APIs should be linked to in the examples in the docs.

For example in Writing a simple publisher and subscriber where it says:

The first lines of code after the comments import rclpy so its Node class can be used.

"Node" should be a link to https://docs.ros.org/en/jazzy/p/rclpy/api/node.html

create_publisher declares that the node publishes messages of type String

"String" should be a link to http://docs.ros.org/en/jazzy/p/std_msgs/interfaces/msg/String.html

And the links should be aligned with the ros version of the docs.

I believe this would help developers find and navigate the documentation and help with search engine optimization (as search engines "crawl" assigning values to linked-to sites).

EmmanuelMess avatar Feb 02 '25 17:02 EmmanuelMess

That indeed sounds like a good improvement! A pull request would be appreciated 😃

And the links should be aligned with the ros version of the docs.

This is how we deal with that: https://docs.ros.org/en/rolling/The-ROS2-Project/Contributing/Contributing-To-ROS-2-Documentation.html#macros

christophebedard avatar Feb 02 '25 17:02 christophebedard

I don't disagree with this issue in principle, but back-filling most referenced objects with the API documentation is a pretty heavy lift. The API docs could stand significant improvement before we spend time back-filling the docs.

kscottz avatar Feb 03 '25 22:02 kscottz

I don't disagree with this issue in principle, but back-filling most referenced objects with the API documentation is a pretty heavy lift. The API docs could stand significant improvement before we spend time back-filling the docs.

If you sort by most common and only do examples, I think that the amount to fix is manageable. I would also add a rule that new docs have to be linked to APIs.

EmmanuelMess avatar Feb 04 '25 12:02 EmmanuelMess

hello team, can I take over resolving this issue?

vimal0athithan avatar Mar 30 '25 16:03 vimal0athithan

@vimal0athithan of course you can, thanks!

fujitatomoya avatar Mar 30 '25 18:03 fujitatomoya

We should probably get #5050 merged before this, since it adds macros to link to interface (e.g., message) docs.

christophebedard avatar Mar 30 '25 20:03 christophebedard

@christophebedard I just sent over a second approval.

@vimal0athithan I would take a look at #5050 and understand what it is doing. Once that gets merged why don't we try a single page to test it out. Let's go slow rolling this out. Once we're a little more confident we can work on batches of a handful of files.

kscottz avatar Apr 01 '25 22:04 kscottz

I just opened #5206 to link to a package's API docs (not to any specific pages in those docs). You could use those macros like this, though:

{package_link(rclpy)}api/node.html

This would expand to (for Rolling):

https://docs.ros.org/en/rolling/p/rclpy/api/node.html

christophebedard avatar Apr 01 '25 23:04 christophebedard