devdocs icon indicating copy to clipboard operation
devdocs copied to clipboard

Include search aliases in the docs.json file

Open manishrc opened this issue 1 year ago • 1 comments

https://documents.devdocs.io/docs.json currently does not include the search aliases as defined in https://github.com/freeCodeCamp/devdocs/blob/5c82069d893bc8dce505f421c6cf05135a593c33/assets/javascripts/models/entry.js#L20-L54

https://github.com/freeCodeCamp/devdocs/blob/5c82069d893bc8dce505f421c6cf05135a593c33/lib/docs/core/doc.rb#L81-L87

Including the search aliases will help external tools integrate better with DevDocs.

Reference issue https://github.com/raycast/extensions/issues/14100#issuecomment-2298802285

manishrc avatar Aug 20 '24 21:08 manishrc

related: #2210

chrisgrieser avatar Sep 22 '24 03:09 chrisgrieser

Sorry to bump a closed issue, but it looks like the full alias list is still not available in the API response. Slightly modifying @chrisgrieser's check here: https://github.com/freeCodeCamp/devdocs/pull/2344#issuecomment-2493464489

curl -sL "https://devdocs.io/docs.json" | grep "alias" | grep -v "null" | count
# 13

Compare to the list of aliases on the site (https://devdocs.io/help):

document.getElementsByClassName("_aliases")[0].querySelectorAll("td").length / 2
// 33

I confirmed that the missing aliases work on the main website. Any idea why only a portion are available? Happy to open a new issue if that's easier.

djpowers avatar Feb 26 '25 23:02 djpowers

Hi @djpowers, I'm very sorry for the long outstanding reply. I found it very hard to troubleshoot and fix this issue. It seems that https://github.com/freeCodeCamp/devdocs/commit/ee145d748f61a679084e8c1cb754511e62a4f9d4 mostly fixed the issue?

> curl -sL "https://devdocs.io/docs.json" | grep "alias" | grep -v "null" | uniq | count
31

The problem was twofold: for one thin, doc slugs containing a version (such as python~3.13) were not handled; for the other, some alias definitions did not match a doc slug (due to a .js suffix for instance).

Cheers!

simon04 avatar Mar 10 '25 20:03 simon04

@simon04 no problem at all, thanks for taking another look! Confirming I'm seeing the additional alias values coming through now. I appreciate the extra context as well.

djpowers avatar Mar 10 '25 21:03 djpowers