Skip to content

3di | Related articles (backport #7239) - #7312

Merged
ahcorde merged 1 commit into
lyricalfrom
mergify/bp/lyrical/pr-7239
Oct 16, 2026
Merged

ahcorde merged 1 commit into
lyricalfrom
mergify/bp/lyrical/pr-7239

Conversation

@mergify

@mergify mergify Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Description

This PR adds a Sphinx extension with a .. ros-related-articles:: directive that, at build time, replaces itself with links to other pages in the set, matched on area from .. meta:: (from the Enhance metadata work #6981).

Matching

  • Matches on the page's primary (first) area value. Another page is related when that value appears anywhere in its area list, so nodes, framework does not pull in every page that only shares framework.
  • area is required on the page with the directive. Missing or empty fails the build. Pages without area are never listed.
  • Field names are normalised for case and separators (:contentType: and :content-type: are the same).

Ordering and layouts

  • Ordered by content-type (About, Process overview, Learning path, How-to, Tutorial, Example, Reference, Release note), then title. Unknown or missing types sort last.
  • tutorial: other tutorials first, then remaining related articles (no duplicates).
  • navigation, or :layout: by-area: one list per area value on the page.
  • :max: caps items per list (default: no cap).

Output

If the author writes Related articles: as a normal paragraph above the list, page load turns that paragraph into an h3 and strips the colon. An existing heading, different wording, or a missing intro is left alone. The generated lists still appear either way.

In case someone wanted to add an extra link manually, any list immediately before or after the directive is kept as hand-written. Generated links are appended. A list below is merged into the one above. Hand-linked pages are dropped from the generated set so nothing appears twice.

Lists over 10 items collapse behind a control that toggles between Show N more articles and Show fewer. Links are plain HTML from the build. Nothing is fetched on page load.

Dependencies

Mechanism only. No articles change in this PR. Lists show up once pages have area in .. meta:: (Enhance metadata PR #6981) and .. ros-related-articles:: is added where needed.

Testing

Add area to a page, add .. ros-related-articles:: (and optionally Related articles: above it), then make html and check the output.

Changes

  • Add plugins/ros_related_articles.py (env-updated index, doctree-resolved resolution, parallel_read_safe and parallel_write_safe).
  • Add source/_static/related_articles.js (intro to heading, expand control).
  • Add plugins/ros_related_articles.md (user guide and developer notes).
  • Update source/_static/custom.css for heading, lists, expand button.
  • Update conf.py to register the extension and script.

Did you use Generative AI?

Yes - Cursor IDE, using models Composer 2.5, Gemini Pro 3.1, Flash 3.6, and Anthropic Sonnet 5 / Opus 5.

Additional Information

Issue: #6991


This is an automatic backport of pull request #7239 done by [Mergify](https://mergify.com).

* Add related articles solution

* Update to align with most recent requirements

* Add readme

* Promote Related articles intro to a heading

* Fix contentType meta matching and refresh related articles docs

* Register ros_related_articles in the extensions list

---------

Signed-off-by: Tully Foote <tullyfoote@intrinsic.ai>
Co-authored-by: Tully Foote <tullyfoote@intrinsic.ai>
(cherry picked from commit d685add)
@mergify mergify Bot mentioned this pull request Oct 16, 2026
@github-actions

Copy link
Copy Markdown

HTML artifacts: https://github.com/ros2/ros2_documentation/actions/runs/38870231427/artifacts/12032888199.

To view the resulting site:

  1. Click on the above link to download the artifacts archive
  2. Extract it
  3. Open html-artifacts-7312/index.html in your favorite browser

@ahcorde
ahcorde merged commit 815b13e into lyrical Oct 16, 2026
6 checks passed
@ahcorde
ahcorde deleted the mergify/bp/lyrical/pr-7239 branch October 16, 2026 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants