-
Notifications
You must be signed in to change notification settings - Fork 166
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
fix: next/prev navigation in docs #2871
Conversation
✅ Deploy Preview for docs-kargo-io ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2871 +/- ##
=======================================
Coverage 49.98% 49.98%
=======================================
Files 275 275
Lines 24526 24526
=======================================
Hits 12259 12259
Misses 11596 11596
Partials 671 671 ☔ View full report in Codecov by Sentry. |
There is a link for a preview of any documentation modifications in the checks section at the bottom of every PR. In this case, you will see that the doc build actually fails with these changes. I don't believe this PR will solve the issue. What I would suggest is using your browser's tools to attempt identifying a font or any other resource that isn't loading correctly on the live site, which may explain this. It could be that some font has been excluded from the static production build that is included when running locally from a Docusaurus server. |
Took a glance. I suspect its related to encoding CSS files that docusaurus generates. One of this or any other reason could be problem
I would start looking at build css files that netlify is serving (if I could download) and search for ".pagination-nav__link--next .pagination-nav__label:after" style |
Here's a new datapoint:
Everything works. So everything comes out ok when:
The issue seems then to only happen with Netlify. I've noticed warnings in the build logs in the past. Maybe they are worth looking into. |
that suspicion about encoding issues is spot on. .pagination-nav__link--prev .pagination-nav__label::before {
content: '� ';
}
.pagination-nav__link--next .pagination-nav__label::after {
content: ' �';
}
i see, so this strengthens the case that the issue is specific to how Netlify handles the build particularly with character encoding in the css since i dont have access to logs on netlify’s dashboard through gh actions, i am not aware of any warnings that might occur during the css minification. I will try an explicit definition of pagination to bypass encoding transformations netlify might apply |
7f747ec
to
0cad23e
Compare
This commit solves the problem with netlify, but there could be a more optimized approach to preempt similar encoding issues in the future—perhaps through a different font choice or other encoding settings. |
docs/docusaurus.config.js
Outdated
docs: { | ||
sidebar: { | ||
hideable: true, | ||
}, | ||
}, |
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.
This is a different feature
and not part of the Issue.
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.
I'd rather not include unrelated changes in a bug fix. Just make a separate PR for this please. This change is actually easier to say yes to on its own that this PR is, so it moves that change along faster.
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.
sure
docs/package.json
Outdated
@@ -17,11 +17,11 @@ | |||
}, | |||
"packageManager": "pnpm@9.0.3", | |||
"dependencies": { | |||
"@cmfcmf/docusaurus-search-local": "^0.11.0", | |||
"@cmfcmf/docusaurus-search-local": "^1.1.0", |
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.
These version updates aren’t necessary to resolve this issue, but in my opinion, it's better to use the latest versions as long as they don't disrupt anything on our site at the moment
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.
Upgrading major versions of a dependency usually runs a higher risk of a compatibility issue. I would suggest doing this as a separate PR.
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.
okay.
docs/src/css/custom.css
Outdated
|
||
/* Pagination symbols for next and previous buttons */ | ||
.pagination-nav__link--prev .pagination-nav__label:before { | ||
content: '« '; | ||
} | ||
|
||
.pagination-nav__link--next .pagination-nav__label:after { | ||
content: ' »'; | ||
} |
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.
Do you know why this fixes the problem?
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.
because custom styles tend to stay unminified in netlify's handling of docusaurus files
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.
I actually did dig docs.akuity.io CNAME
and figured akuity docs site isn't served by Netlify.
Hence, it perhaps were a netlify issue for docs.kargo.io
as Mayur mentioned it seems to come from an encoding conflict during the CSS minification or request processing
docusaurus’s CSS originally defined the content values for pagination symbols correctly, but netlify serves these characters as �
and i think by explicitly setting the content property for .pagination-nav__link
within a custom css file, we avoid re-encoding during minification.
But imo there is more to this issue. It occurs to me that unless I don't use upgraded versions for docusaurus-search-local, clsx and typescript, the site will still not build those symbols correctly.
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.
A lot of that isn't adding up though...
Content type headers on the CSS correctly reflect UTF-8 encoding.
A UTF-8 encoded file, would have no difficulty displaying », so if you open the downloaded and see the � character, that actual character is what's in the file.
So the question is how it got there.
If you build the site locally or in a container, you'll find » in the minified CSS; not �. This means that the minification process, and more broadly the build process, isn't the problem in and of itself.
The only possibilities I see at the moment are:
-
Build/minification is producing a different result in the Netlify build environment for a reason we have not yet identified.
If we can nail this down as being the issue, we can probably fix it because we have a reasonable degree of control over that build environment.
-
The build/minification, even in the Netlfiy build environment, is working perfectly and the file is being corrupted somehow after that. The file would be served from the Netlify CDN, which calls that into question.
It occurs to me that unless I don't use upgraded versions for docusaurus-search-local, clsx and typescript, the site will still not build those symbols correctly.
If this were the issue, we'd be able to replicate the problem in a local build.
0cad23e
to
d46199e
Compare
I can force Netlify's build env to use a different version of Node. Will try tomorrow. |
7516592
to
b11c313
Compare
Since we are already using a
Also, I do not have access to the Netlify Build logs it seems |
Signed-off-by: Faeka Ansari <faeka6@gmail.com>
9ed7eae
to
0e3807e
Compare
Well, I clearly never got around to that as planned. Thank you for beating me to it, @fykaa. 😄 I can see in the logs that the build for the doc preview of this PR used Node 22.11.0. You should also be able to see in the preview that the characters in the prev/next buttons are displaying correctly. Good teamwork. Thanks @Marvin9 for digging up that relevant issue from the docusaurus repo. @fykaa thanks for the fix. LGTM |
Signed-off-by: Faeka Ansari <faeka6@gmail.com> (cherry picked from commit 7813eff)
Successfully created backport PR for |
fixes: #2870
So, it is a quite strange distinction.
I looked into it more, but I could not find any notable differences between Kargo and Akuity that could lead to a navigation failure in the live document.
Aside from that, I did observe that some versions of Package.json were not updated.
But since the navigation appear well locally, I am not sure how to test this change in the live document to see if updating the version was able to improve things.
cc: @Marvin9 ptal