qiskit-documentation/docs/open-source
Arnau Casau 6ef1ebed3d
Update Guides links in preparation of Qiskit 2.0 (#2761)
> [!note]
> The API links will be updated in a follow-up

Part of
https://github.com/Qiskit/documentation/issues/2753#event-16690873639

This PR updates the Guides links to the qiskit 2.0 removed pages to
point to the 1.4 version.

I checked the new links by running our link checker after generating the
2.0.0rc1 as if it was the latest version. Even though this links are
fixed, it seems like we have some links pointing to removed sections
from existing files. The following errors will appear when generating
qiskit 2.0:

```bash
Checking internal links for non-API docs
 Could not find link '/api/qiskit/qiskit.circuit.QuantumCircuit#add_calibration'. Appears in:
    docs/migration-guides/qiskit-1.0-features.mdx     Did you mean '/api/qiskit/qiskit.circuit.QuantumCircuit#visualization'?
 Could not find link '/api/qiskit/compiler#qiskit.compiler.assemble'. Appears in:
    docs/migration-guides/qiskit-quantum-instance.mdx     Did you mean '/api/qiskit/compiler#qiskit.compiler.transpile'?
 Could not find link '../api/qiskit/compiler#circuit-and-pulse-compilation-functions'. Appears in:
    docs/guides/configure-qiskit-local.mdx     Did you mean '/api/qiskit/compiler#circuit-compilation-functions'?
```

To update the links I used the following script:
<details><summary>script</summary>

```ts
import { globby } from "globby";
import { readFile, writeFile } from "fs/promises";
import { QISKIT_REMOVED_PAGES } from "../lib/links/QiskitRemovedPages";

export async function updateBrokenLinks(filePath: string): Promise<void> {
  let markdown = (await readFile(filePath)).toString();

  QISKIT_REMOVED_PAGES.forEach((link) => {
    var regex = new RegExp(`\\]\\(([^\)]*)/api/qiskit/${link}\\)`, "g");
    var regex2 = new RegExp(
      `\\]\\(([^\)]*)/api/qiskit/${link}#([^\)]*)\\)`,
      "g",
    );

    markdown = markdown.replaceAll(regex, `\]\(/api/qiskit/1.4/${link}\)`);
    markdown = markdown.replaceAll(regex2, `\]\(/api/qiskit/1.4/${link}#$2\)`);
  });

  await writeFile(filePath, markdown);
}

async function main() {
  const globs = ["docs/{guides,migration-guides,open-source}/*.{ipynb,mdx}"];
  const allGuides = await globby(globs);
  for (const guide of allGuides) {
    await updateBrokenLinks(guide);
  }
}

main().then(() => process.exit());
```
</details>
2025-03-17 17:58:34 +00:00
..
_toc.json
code-of-conduct.mdx
create-a-provider.mdx Update Guides links in preparation of Qiskit 2.0 (#2761) 2025-03-17 17:58:34 +00:00
index.mdx Sync some of the new cloud docs (#2679) 2025-02-27 14:52:14 +00:00
qiskit-sdk-version-strategy.mdx Update versioning and platform support for 2.0 (#2731) 2025-03-11 14:42:18 +00:00