Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Teach website sidebar to prefer en-US
Summary: When I reran the website build toolchain for the 0.9.1 release I ended up updating the `metadata.js` file: 88c41e9 This in turn meant that we had multiple documents with the same id; eg: - thinking-in-graphql But different permalinks: - docs/thinking-in-graphql.zh-CN.html - docs/thinking-in-graphql.html When I committed and pushed the generated documentation, ie: eef148d I saw that our sidebar table of contents was now using the localized version of the document; ie: > 深入理解 GraphQL instead of: > Thinking in GraphQL The solution for now is to always prefer non-localized resources in the sidebar, but in the long term we'll want the localized version of each page to prefer localized links in the sidebar, if they exist. This may be tricky to implement, however, because we don't control the gh-pages environment and so can't necessarily implement the logical `Accept-Language` solution (although perhaps GitHub will... maybe they already do?). For now just getting the fix out. The updated, published documentation went out in: 52b908d Aside: this commit takes care to preserve ordering, so that the "find first element which doesn't have any previous" logic can rely on it. But this is not well-defined behavior because (I think) the order in which we're visiting the source files (as returned by `glob.sync(MD_DIR + '**/*.*')` in `website/server/convert.js`) is actually filesystem-dependent. On HFS+ (macOS) this happens to be lexicographically ordered, but I know of other filesystems where it is dependent on things like inode metadata layout and such. Closes #1238 Pulled By: wincent fbshipit-source-id: dd46ba2ba2b9972afd8a720a31407c8d3f29343c
- Loading branch information