fix(links): drop the hardcoded baseUrl and repair stale anchors - #4736
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| :::note | ||
|
|
||
| If you are building an Ionic Angular app, the styles need to be added to a global stylesheet file. Read [Style Placement](#style-placement) in the Angular section below for more information. | ||
| If you are building an Ionic Angular app, the styles need to be added to a global stylesheet file. |
There was a problem hiding this comment.
The section only existed in v5.
| :::note | ||
|
|
||
| If you are building an Ionic Angular app, the styles need to be added to a global stylesheet file. Read [Style Placement](#style-placement) in the Angular section below for more information. | ||
| If you are building an Ionic Angular app, the styles need to be added to a global stylesheet file. |
There was a problem hiding this comment.
The section only existed in v5.
| ``` | ||
|
|
||
| This error is an error code from Xcode that can be caused by provisioning issues or outdated cordova dependencies. To fix this error first make sure a provisioning profile has been generated using the above instructions and then try to [run the app from Xcode](../developing/ios.mdx#running-with-xcode). | ||
| This error is an error code from Xcode that can be caused by provisioning issues or outdated cordova dependencies. To fix this error first make sure a provisioning profile has been generated using the above instructions and then try to [run the app from Xcode](/developing/ios.mdx). |
There was a problem hiding this comment.
That section only existed in v5 and v6.
| ``` | ||
|
|
||
| This error is an error code from Xcode that can be caused by provisioning issues or outdated cordova dependencies. To fix this error first make sure a provisioning profile has been generated using the above instructions and then try to [run the app from Xcode](../developing/ios.mdx#running-with-xcode). | ||
| This error is an error code from Xcode that can be caused by provisioning issues or outdated cordova dependencies. To fix this error first make sure a provisioning profile has been generated using the above instructions and then try to [run the app from Xcode](/developing/ios.mdx). |
There was a problem hiding this comment.
That section only existed in v5 and v6.
|
|
||
| :::note | ||
| If you are building an Ionic Angular app, the styles need to be added to a global stylesheet file. Read [Style Placement](#style-placement) in the Angular section below for more information. | ||
| If you are building an Ionic Angular app, the styles need to be added to a global stylesheet file. |
There was a problem hiding this comment.
The section only existed in v5.
| ``` | ||
|
|
||
| This error is an error code from Xcode that can be caused by provisioning issues or outdated cordova dependencies. To fix this error first make sure a provisioning profile has been generated using the above instructions and then try to [run the app from Xcode](../developing/ios.mdx#running-with-xcode). | ||
| This error is an error code from Xcode that can be caused by provisioning issues or outdated cordova dependencies. To fix this error first make sure a provisioning profile has been generated using the above instructions and then try to [run the app from Xcode](../developing/ios.mdx). |
There was a problem hiding this comment.
That section only existed in v5 and v6.
ShaneK
left a comment
There was a problem hiding this comment.
Looks good to me, great work! English comes out at 0 broken links and 0 broken anchors in a local build, down from 7 and 40 on main, and the couple of things I left are nits. 🚀
| "type": "link", | ||
| "label": "Responsive Grid", | ||
| "href": "/docs/api/grid" | ||
| "href": "/api/grid" |
There was a problem hiding this comment.
| "href": "/api/grid" | |
| "href": "/v8/api/grid" |
This renders as /docs/api/grid, so the v8 sidebar sends people to the v9 docs. Pre-existing rather than something you introduced, but the line's already open here, and the v6/v7 sidebars have the same entry.
| let docs = prop.docs; | ||
| if (isVirtual) { | ||
| docs = `${docs}\n\nThis is a [virtual property](/docs/core-concepts/fundamentals#virtual-properties) that is set once during initialization and will not update if you change its value after the initial render.`; | ||
| docs = `${docs}\n\nThis is a [virtual property](/core-concepts/fundamentals#virtual-properties) that is set once during initialization and will not update if you change its value after the initial render.`; |
There was a problem hiding this comment.
Under ja this resolves to the right page but the Japanese fundamentals heading has no explicit id, so it comes out as 103 broken anchors (they were hard 404s before this PR, so still a win). Adding {/* #virtual-properties */} to that heading in the translation/jp copy clears all 103, matching what's already there for #adaptive-styling.
There was a problem hiding this comment.
Agreed. The jp heading is ### 仮想プロパティ, so it needs {/* #virtual-properties */} the same way #adaptive-styling already does two headings up.
It points at a bigger question though: 1,072 translated ja headings have no pinned id, so their anchors can't match English. I want to look into whether the standard should be that headings in docs/ carry explicit ids.
| <p>A modern, open source native runtime built and maintained by the Ionic team and the Capacitor community. Our recommended native solution.</p> | ||
| </DocsCard> | ||
| <DocsCard header="Cordova plugins" img="/img/native/cordova@2x.png" href="/native/community"> | ||
| <DocsCard header="Cordova plugins" img="/img/native/cordova@2x.png" href="/v5/native/community"> |
There was a problem hiding this comment.
Any reason this one keeps an in-site path rather than the archive URL from versionsArchived.json like the others here? It does work and the file's in an unbuilt tree anyway, so purely consistency - up to you!
There was a problem hiding this comment.
The archive URLs elsewhere are for targets that don't exist in any built tree. Here the target is in the same tree, native-community.mdx with slug: /native/community, so there's a real page to point at.
Kept it internal because the archive URL is never the better of the two. If v5 were ever unarchived it would send people to a frozen snapshot instead of the page that just got built, and it's another hardcoded deploy URL we'd have to remember to update if that archive ever moves, which nothing in the build would catch.
Issue URL: internal
What is the current behavior?
The Japanese site renders 724 broken links. English renders 21, plus 50 broken anchors nobody had noticed. The archived v5, v6 and v7 docs carry the same defects and have never been checked, because they are not built.
Nearly every broken link is one defect: links hardcode the
/docsbaseUrl. Docusaurus prepends the baseUrl of the locale being built, and the Japanese one is/docs/ja/, so the prefix doubles into/docs/ja/docs/theming/basics. English hides it, because a value that already starts with its own baseUrl is passed through untouched.The anchors are unrelated: fragments pointing at headings renamed years ago.
#style-placementand#optimizing-your-buildwere v5 sections, dead through four majors.What is the new behavior?
English is at 0 broken links and 0 broken anchors. Japanese links drop 724 to 152, with nothing left that originates in an English source file. Built with all five versions, the archived trees come out clean apart from five links noted below.
/api/toolbar.mdx. The extension matters: the resolver only fires on.mdand.mdx, and it searches the localized content path first, which makes this the one style that is both locale correct and version correct.hrefattributes take the same path without an extension, since no resolver runs there and the value goes straight toLink.Does this introduce a breaking change?
Other information
60 anchors will still be reported, and all 60 work. Docusaurus collects anchors only from components that call
collectAnchor, so a raw<section id="cli">written straight into MDX is invisible to it. The v5 and v6 glossaries are built that way. These should not be "fixed".5 links stay broken in v5. They come from
@ionic/docs@5, which uses a relative link style dropped after v5, and exist only in a build-time partial, so there is no file to edit. v5 is not built.Japanese broken anchors rise 66 to 148. That is not new breakage: links that used to 404 now land on the correct translated page, whose heading slug is Japanese, so the fragment misses instead.
ja never builds in PR previews, so none of this is visible from the preview link. I verified with a local two-locale build, and again with v5, v6 and v7 temporarily added to
versions.json.Everything still broken lives in
translation/jp. The plan is this PR, then a normal main to jp sync, which carries most of the prose fixes as conflicts to resolve, then a small jp PR for the rest. 103 of the Japanese leftovers are a single missing heading id in the jpfundamentals.mdx, on a heading whose slug is Japanese.