-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add --canonical-base-url cli option to docs generator #5990
Conversation
This won't work: The docs generator is not only used for the standard lib. With this change, any API docs would point to This could probably be implemented as an optional CLI flag and entirely omitted unless explicitly specified. And |
My bad, I made a mental shortcut 😅 |
Now it'll add it only for crystal repo docs. It's a kinda dirty hack, maybe cli option would be better... WDYT? |
</script> | ||
<% if repository_name == CRYSTAL_REPOSITORY_NAME %> | ||
<link rel="canonical" href="<%= CANONICAL_BASE_URL %>" /> | ||
<% end %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not add this to HeadTemplate
?
src/compiler/crystal/tools/doc/html/_head.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK there's no type
in HeadTemplate
.
Before merging this, someone with access should do the experiment and later change all old pages. |
Please just make it configurable. This feature is useful for other crystal libraries as well. |
@straight-shoota done. |
Maybe it would be better to put it in the HeadTemplate (add type), along with that repository name and base path, too. |
@straight-shoota done. |
@RX14 @sdogruyol ready for review. |
…5990) * Add <link rel="canonical"> to the latest API docs * Revert "Add <link rel="canonical"> to the latest API docs" This reverts commit fc5068e. * Add --canonical-base-url cli option to docs generator * Generate crystal docs with --canonical-base-url set * Refactor HeadTemplate to DRY-it up a lil’
…al-lang#5990)" This reverts commit a6d0571.
…al-lang#5990)" This reverts commit a6d0571.
Closes #5952