devdocs
devdocs copied to clipboard
Add field to docs.json denoting available aliases
This PR adds an "alias" key while generating https://documents.devdocs.io/docs.json, reusing the predefined aliases: https://github.com/freeCodeCamp/devdocs/blob/5c82069d893bc8dce505f421c6cf05135a593c33/assets/javascripts/models/entry.js#L20-L54
Sample output for one doc item looks like so:
{
"name": "JavaScript",
"slug": "javascript",
"type": "mdn",
"links": {
"home": "https://developer.mozilla.org/en-US/docs/Web/JavaScript",
"code": "https://github.com/mdn/content/tree/main/files/en-us/web/javascript"
},
"mtime": 1724174503,
"db_size": 15314120,
"attribution": "© 2005–2024 MDN contributors.<br>\n Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.",
"alias": "js"
},
This closes #2309, which provides more context on the rationale for this proposed change.
This implementation works, but could admittedly be more robust. I was hoping to avoid the aliases being defined in multiple places, and this seemed like the easiest approach to do so given we're working across JavaScript and Ruby.
Given that, if the team is open to this change, I'm happy to refactor if there's a preferred strategy. Thanks!