Skip to content
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

Merged
merged 5 commits into from Apr 25, 2018

Conversation

Sija
Copy link
Contributor

@Sija Sija commented Apr 22, 2018

Closes #5952

@straight-shoota
Copy link
Member

This won't work: The docs generator is not only used for the standard lib. With this change, any API docs would point to https://crystal-lang.org/api/latest/ as canonical URL!

This could probably be implemented as an optional CLI flag and entirely omitted unless explicitly specified.

And CANONICAL_BASE_URL would be a more descriptive name.

@Sija
Copy link
Contributor Author

Sija commented Apr 22, 2018

My bad, I made a mental shortcut 😅

@Sija
Copy link
Contributor Author

Sija commented Apr 22, 2018

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 %>
Copy link
Member

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

Copy link
Contributor Author

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.

@oprypin
Copy link
Member

oprypin commented Apr 22, 2018

Before merging this, someone with access should do the experiment and later change all old pages.

@straight-shoota
Copy link
Member

Please just make it configurable. This feature is useful for other crystal libraries as well.

@Sija
Copy link
Contributor Author

Sija commented Apr 23, 2018

@straight-shoota done.

@Sija Sija changed the title Add <link rel="canonical"> to the latest API docs Add --canonical-base-url cli option to docs generator Apr 23, 2018
@straight-shoota
Copy link
Member

Maybe it would be better to put it in the HeadTemplate (add type), along with that repository name and base path, too.

@Sija
Copy link
Contributor Author

Sija commented Apr 23, 2018

@straight-shoota done.

@Sija
Copy link
Contributor Author

Sija commented Apr 24, 2018

@RX14 @sdogruyol ready for review.

@sdogruyol sdogruyol merged commit a6d0571 into crystal-lang:master Apr 25, 2018
@sdogruyol sdogruyol added this to the Next milestone Apr 25, 2018
chris-huxtable pushed a commit to chris-huxtable/crystal that referenced this pull request Jun 6, 2018
…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’
straight-shoota added a commit to straight-shoota/crystal that referenced this pull request Oct 18, 2019
straight-shoota added a commit to straight-shoota/crystal that referenced this pull request Oct 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants