|
| 1 | +--- |
| 2 | +navigation_title: Inbound Crosslinks |
| 3 | +--- |
| 4 | + |
| 5 | +# Inbound Crosslinks |
| 6 | + |
| 7 | +**Inbound crosslinks** are links from other documentation sets to yours. Understanding and validating inbound crosslinks helps prevent breaking links in other repositories when you make changes. |
| 8 | + |
| 9 | +## Purpose |
| 10 | + |
| 11 | +Inbound crosslink validation allows you to: |
| 12 | + |
| 13 | +* **Detect breaking changes** - Know when renaming or deleting a file will break links from other repositories |
| 14 | +* **Prevent regressions** - Avoid publishing changes that break documentation elsewhere |
| 15 | +* **Coordinate changes** - Understand dependencies before making structural changes |
| 16 | + |
| 17 | +## How it works |
| 18 | + |
| 19 | +When you build your documentation, `docs-builder` can validate inbound crosslinks by: |
| 20 | + |
| 21 | +1. **Fetching your published Link Index** - Gets your repository's [Link Index](link-index.md) from the [Link Service](link-service.md) |
| 22 | +2. **Comparing with local changes** - Compares your current local state with the published Link Index |
| 23 | +3. **Detecting differences** - Identifies files that have been moved, renamed, or deleted |
| 24 | +4. **Checking references** - Queries the Link Service to see if other repositories link to the changed files |
| 25 | +5. **Reporting warnings** - Alerts you to potential breaking changes |
| 26 | + |
| 27 | +## Validation commands |
| 28 | + |
| 29 | +### Validate all inbound links |
| 30 | + |
| 31 | +Check all inbound crosslinks for your repository: |
| 32 | + |
| 33 | +```bash |
| 34 | +docs-builder inbound-links validate-all |
| 35 | +``` |
| 36 | + |
| 37 | +### Validate specific link reference |
| 38 | + |
| 39 | +Validate a locally built `links.json` against all published Link Index files: |
| 40 | + |
| 41 | +```bash |
| 42 | +docs-builder inbound-links validate-link-reference --file .artifacts/docs/html/links.json |
| 43 | +``` |
| 44 | + |
| 45 | +### Validate with filters |
| 46 | + |
| 47 | +Check inbound links from specific repositories or to specific resources: |
| 48 | + |
| 49 | +```bash |
| 50 | +docs-builder inbound-links validate --from elasticsearch --to kibana |
| 51 | +``` |
| 52 | + |
| 53 | +## Common scenarios |
| 54 | + |
| 55 | +### Moving a file |
| 56 | + |
| 57 | +If you move a file that other repositories link to: |
| 58 | + |
| 59 | +1. Create a redirect from the old path to the new path |
| 60 | +2. Update your documentation's redirect configuration |
| 61 | +3. Run inbound link validation to ensure the redirect works |
| 62 | +4. Notify teams that maintain repositories with inbound links |
| 63 | + |
| 64 | +### Deleting a file |
| 65 | + |
| 66 | +Before deleting a file: |
| 67 | + |
| 68 | +1. Run inbound link validation to see if other repositories link to it |
| 69 | +2. If there are inbound links, coordinate with those teams first |
| 70 | +3. Consider leaving a redirect to related content |
| 71 | +4. Update the other repositories to remove or update their links |
| 72 | + |
| 73 | +### Renaming headings |
| 74 | + |
| 75 | +Heading anchors are part of the Link Index. If other repositories link to specific headings in your documentation: |
| 76 | + |
| 77 | +1. Validate inbound links before renaming |
| 78 | +2. Consider keeping old heading anchors if heavily linked |
| 79 | +3. Document the change if coordination is needed |
| 80 | + |
| 81 | +## Integration with CI/CD |
| 82 | + |
| 83 | +You can integrate inbound link validation into your CI/CD pipeline: |
| 84 | + |
| 85 | +```yaml |
| 86 | +- name: Validate inbound links |
| 87 | + run: | |
| 88 | + docs-builder inbound-links validate-link-reference \ |
| 89 | + --file .artifacts/docs/html/links.json |
| 90 | +``` |
| 91 | +
|
| 92 | +This will fail the build if you're about to break links from other repositories. |
| 93 | +
|
| 94 | +## Best practices |
| 95 | +
|
| 96 | +### Set up redirects |
| 97 | +
|
| 98 | +When moving or renaming files, always set up redirects: |
| 99 | +
|
| 100 | +```yaml |
| 101 | +# In your documentation's configuration |
| 102 | +redirects: |
| 103 | + - from: /old-path/file.html |
| 104 | + to: /new-path/file.html |
| 105 | +``` |
| 106 | +
|
| 107 | +### Communicate changes |
| 108 | +
|
| 109 | +If you need to make a breaking change: |
| 110 | +
|
| 111 | +1. Run inbound link validation to identify affected repositories |
| 112 | +2. File issues or notify maintainers of affected repositories |
| 113 | +3. Coordinate the change timing |
| 114 | +4. Provide redirect mappings or alternative URLs |
| 115 | +
|
| 116 | +### Validate before merging |
| 117 | +
|
| 118 | +Make inbound link validation part of your review process: |
| 119 | +
|
| 120 | +* Run validation locally before creating a PR |
| 121 | +* Include validation in CI checks |
| 122 | +* Review validation results before merging |
| 123 | +
|
| 124 | +## Related concepts |
| 125 | +
|
| 126 | +* [Outbound Crosslinks](outbound-crosslinks.md) - Links from your documentation to others |
| 127 | +* [Link Index](link-index.md) - How your linkable resources are tracked |
| 128 | +* [Link Service](link-service.md) - Where inbound link information is stored |
| 129 | +* [Distributed Documentation](distributed-documentation.md) - The architecture enabling this validation |
0 commit comments