AI & information

Extract links with AI without changing their destinations

Keep link labels separate from addresses, preserve query parameters and fragments, and distinguish exact extraction from a checked destination.

You ask an assistant to collect the references from a document. It returns a neat list, but two links now lead to the same place. The cleanup may have removed the difference you needed. Give the assistant an extraction task with explicit rules, rather than asking it to improve the addresses.

Keep the label and address in separate fields

A visible label such as “setup instructions” is not the address behind it. Request the label, original destination, and location in the source document. If a copied text contains only labels and has lost the hyperlinks, the assistant should mark their destinations as unavailable, not reconstruct plausible URLs.

Consider these fictional relative destinations: /guide.html?lang=en#setup and /guide.html?lang=en#cleanup. They share a page and query but name different sections. Removing everything after # loses that distinction. The fragment can direct the browser to a section; a query can affect the server's response. Neither should be discarded just because the address looks long.

Preserve the original spelling and encoding. If the task later requires resolved absolute addresses or normalized forms, put those in separate fields and document the transformation. Keep the original destination available for comparison.

Check extraction and navigation separately

Start with a sample containing two section links, a linked phrase, and a plain-text URL followed by sentence punctuation. Check where the address actually ends. Do not strip punctuation mechanically: some punctuation can belong to the address itself.

Compare every extracted entry with its source before relying on the full list. Then, where appropriate, open ordinary public references and confirm both page and section. A successful page load does not prove the fragment reached the intended passage.

Record separate results for “copied exactly” and “destination checked.” Keep private sharing links out of public lists and third-party checking services. If a destination cannot be checked, leave that status visible instead of calling the entire list verified.

Sources & further reading

  1. MDN: URI fragments
  2. MDN: URI queries

Sources support the technical explanations. Examples and suggested checks are editorial guidance.