-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce a new URL for library pages, at index.html #3895
Conversation
Would it make sense to have a mode that doesn't emit redirects at all, and renames the output files for all the symbol types that aren't suffixed, like variable, enum, and function (so the top level "index" variable doesn't collide with "index.html", etc.)? Then that mode could be used for "new" output, and the redirects could be used for "legacy" output. I'd hate to think that we're stuck emitting ever larger numbers of redirect files every time we rename something in the output tree. |
We could have a mode that stops emitting the redirecting files. You'd enable it whenever you're comfortable with some % of broken links coming from StackOverflow, articles, etc. |
I was imagining using it mainly for new packages, so in those cases there wouldn't be any broken links. |
Ah, we could do that. It wouldn't be used very much, as a new package author would have to know about it and include it in their dartdoc_options.yaml, or it could be the default and offer the "please don't break old links" mode be opt-in. |
Okay, maybe not worth the effort, then. Having it be the default might cause havoc (since people wouldn't know to turn it on and make lots of broken links), and having it not be the default means it won't be used much. |
12113f2
to
64dda21
Compare
Fixes dart-lang#1346 This "moves" the URL of each library from, e.g. 'package-two_lib2/package-two_lib2-library.html' to 'package-two_lib2/index.html', such that we can have links with 'package-two_lib2'. The old URLs are preserved via redirecting HTML files. (HTTP redirects are more standard and recommended, but dartdoc does not contain an HTTP server; HTTP redirects could be implemented at the hosting server, which is different for different doc hosts (Google Storage, Firebase, ...). Instead we use simpler HTML redirects. In fact, a given backend host could use the HTML redirecting files as a database to inform HTTP redirect rules, that need to be implemented differently for each backend. So dartdoc now produces redirecting files, but a given backend could instead return an HTTP 301 Permanent Redirect response when requesting one of the redirecting files.) This adds a negligible number of files (1 per documented library), and a negligible number of bytes (tiny redirect files), but actually is probably a net negative in terms of bytes, as many links are now shortened, removing the HTML file name of library URLs.
Ready for review @dart-lang/analyzer-team . Big feature for dartdoc. |
Fixes #1346
This "moves" the URL of each library from, e.g.
'package-two_lib2/package-two_lib2-library.html' to 'package-two_lib2/index.html', such that we can have links with 'package-two_lib2'. The old URLs are preserved via redirecting HTML files.
(HTTP redirects are more standard and recommended, but dartdoc does not contain an HTTP server; HTTP redirects could be implemented at the hosting server, which is different for different doc hosts (Google Storage, Firebase, ...). Instead we use simpler HTML redirects. In fact, a given backend host could use the HTML redirecting files as a database to inform HTTP redirect rules, that need to be implemented differently for each backend. So dartdoc now produces redirecting files, but a given backend could instead return an HTTP 301 Permanent Redirect response when requesting one of the redirecting files.)
This adds a negligible number of files (1 per documented library), and a negligible number of bytes (tiny redirect files), but actually is probably a net negative in terms of bytes, as many links are now shortened, removing the HTML file name of library URLs.
Contribution guidelines:
dart format
.Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.