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

Canonical URL calculation is off for top-level functions #2122

Closed
isoos opened this issue Jan 10, 2020 · 8 comments · Fixed by #2126
Closed

Canonical URL calculation is off for top-level functions #2122

isoos opened this issue Jan 10, 2020 · 8 comments · Fixed by #2126
Assignees
Labels
P1 A high priority bug; for example, a single project is unusable or has many test failures type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@isoos
Copy link
Contributor

isoos commented Jan 10, 2020

dartdoc: 0.30.0+1

example top-level function:

expected content in HTML:

  • <link rel="canonical" href="https://pub.dartlang.org/documentation/pana/0.12.2/pana/prettyJson.html">

actual content in HTML:

  • <link rel="canonical" href="https://pub.dartlang.org/documentation/pana/0.12.2/../pana/prettyJson.html">

(note the /../ segment between /0.12.2/ and /pana/)

@isoos
Copy link
Contributor Author

isoos commented Jan 10, 2020

Not only for top-level ones, but other files too, e.g.:

<link rel="canonical" href="https://pub.dev/documentation/pana/0.12.2/models/LicenseFile/LicenseFile.html">

vs

<link rel="canonical" href="https://pub.dev/documentation/pana/0.12.2/../../models/LicenseFile/LicenseFile.html">

@jcollins-g jcollins-g added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) P0 A serious issue requiring immediate resolution labels Jan 10, 2020
@jcollins-g
Copy link
Contributor

This seems only to impact pub, but they are an important customer. Maybe there is some bad interaction with the --rel-canonical-prefix flag.

@jcollins-g
Copy link
Contributor

@isoos Does the --use-base-href flag makes any difference?

@isoos
Copy link
Contributor Author

isoos commented Jan 10, 2020

Does the --use-base-href flag makes any difference?

It does: the canonical URL is good, and it brings back the <base> tag. Should we use that? (Is that the replacement of --hosted-url?)

@jcollins-g
Copy link
Contributor

We should consider it a temporary fix until we can figure out what's wrong with the URL generation. Future versions of dartdoc can't rely on base href because markdown can't work well with it.

@jcollins-g jcollins-g added P1 A high priority bug; for example, a single project is unusable or has many test failures and removed P0 A serious issue requiring immediate resolution labels Jan 10, 2020
@jdkoren
Copy link
Contributor

jdkoren commented Jan 10, 2020

I actually removed --hosted-url because it wasn't being used anywhere in the code or templates.

I think I know what's happening, but it may take a bit to figure out a fix. In the meantime, you can use --use-base-href to restore the original behavior, and it should give you the expected content.

@isoos
Copy link
Contributor Author

isoos commented Jan 10, 2020

The patch for the canonical URL is not too bad in our code, so I'd rather wait for a future release to get this fixed (not in a hurry with that), than going back and forth with the <base> changes again (as I've verified the new version without it on the staging site).

@jcollins-g
Copy link
Contributor

leaving as P1 since there is a workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 A high priority bug; for example, a single project is unusable or has many test failures type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants