Did you search for Drupal API documentation in the past and ended up on outdated information on api.drupal.org? I heard this story from many people before and it also happens to AI bots. This is a problem the Drupal Association wanted to fix for a while but did not get around to it with all the priorities. As I already have ddev locally, I was delighted to find that there is a self-contained demo script that gave me a local API site very quickly.I was in contact with the maintainer Fran Garcia-Linares all along, and he gave me great guidance as to how to best implement the features I wanted. While this helped build the feature within the hackathon, you don’t need Fran on Slack to build against the codebase. You would need him to merge it of course! 🙂 That said, I did run out of time to add tests for this and he helped bring it home! All in all he rolled it out on api.drupal.org earlier this week, so now it is live! But what did it take?Acquia held an internal hackathon called 48Create on 15-16 May, 2025. I joined the team formed by Ben Mullins around Drupal documentation and I decided to take on this problem. 

  1. The codebase did know which version was the latest/preferred, but it did not know which version of a project was supported. To properly inform users, I added the backend feature to keep track of which version is supported.
  2. Using that information, now different messages are displayed if you are on a version still supported but is not the latest (Drupal 10 at this time) or if you are on an old version that is not even supported anymore (8.9.x for example). I took inspiration from similar messages in the Symfony documentation.
  3. When a corresponding page is available in the latest version, the specific page will be linked. When there is no such page, the index of the latest version is linked.
  4. Since it is not just about directing humans, I also added a canonical link reference to the HTML header to direct bots to the same place too. For the above example that is <link rel="canonical" href="/api/drupal/core%21core.api.php/group/best_practices/11.x" />

While I built a lot of things for Drupal before, this was the first time I built anything for api.drupal.org in particular. It does not sound like a huge undertaking but I think it will have nice ripple effects. With the demo script, it is now really the easiest it ever was to fix problems and build new features for api.drupal.org. What will you improve?

Similar Posts