You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update root-dir recipe after relative root-dirs (#139)
* Update root-dir recipe after relative root-dirs
also remove the suggestion to use root-dir and base-url together.
* change tree diagram so text is upright instead of slanted
slant came from the bash syntax highlighting mode.
For GitHub Actions, please replace `$(pwd)` with [`${{ github.workspace }}`](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs#github-context):
87
-
88
-
```yaml '${{ github.workspace }}'
89
-
jobs:
90
-
check-links:
91
-
runs-on: ubuntu-latest
92
-
steps:
93
-
- uses: actions/checkout@v5
94
-
- uses: lycheeverse/lychee-action@v2
95
-
with:
96
-
args: >-
97
-
--verbose
98
-
--no-progress
99
-
--root-dir "${{ github.workspace }}/public"
100
-
"public/**/*.html"
101
-
```
75
+
For GitHub Actions, the working directory can be accessed with [`${{ github.workspace }}`](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs#github-context).
102
76
103
77
### Documentation Site
104
78
@@ -116,7 +90,7 @@ To check these links:
116
90
117
91
```bash
118
92
# Assuming you're in the project root
119
-
lychee --root-dir "$(pwd)" "docs/**/*.html"
93
+
lychee --root-dir ."docs/**/*.html"
120
94
```
121
95
122
96
## The Difference Between `--root-dir` and `--base-url`
@@ -125,52 +99,28 @@ These parameters serve different purposes:
125
99
126
100
-`--root-dir` is for finding files on your computer
127
101
- Only affects links that start with `/`
128
-
- Must be an absolute filesystem path
102
+
- Must be a filesystem path
129
103
- Used when checking local files
130
104
131
105
-[`--base-url`](/recipes/base-url) is for resolving URLs
132
106
- Must be a URL (like `https://example.com/docs/`)
133
107
- Used when checking how links will work once deployed
134
-
- Affects relative links (like `./guide.html`)
135
-
136
-
### Using Both Together
137
-
138
-
Sometimes you need both:
139
-
140
-
```bash
141
-
lychee \
142
-
--root-dir "$(pwd)/public" \
143
-
--base-url https://example.com/ \
144
-
"public/**/*.html"
145
-
```
146
-
147
-
This tells lychee:
148
-
149
-
1. Look for `/`-prefixed files in `./public/`
150
-
2. Resolve relative links against `https://example.com/`
108
+
- Affects all relative links (like `./guide.html`)
151
109
152
110
## Troubleshooting
153
111
154
112
If your links aren't being found:
155
113
156
-
1. Make sure you're using an absolute path:
114
+
1.Check that the files exist in the location you expect:
157
115
158
-
```bash
159
-
# Get absolute path in bash
160
-
full_path="$(pwd)/public"
161
-
lychee --root-dir "$full_path" "**/*.html"
162
-
```
116
+
```bash
117
+
# Example debugging steps
118
+
ls -la ./public/about.html
119
+
ls -la ./public/docs/guide.html
120
+
```
163
121
164
-
2. Check that the files exist in the location you expect:
122
+
2.Use `--verbose` to see how lychee is resolving paths:
165
123
166
-
```bash
167
-
# Example debugging steps
168
-
ls -la ./public/about.html
169
-
ls -la ./public/docs/guide.html
170
-
```
171
-
172
-
3. Use `--verbose` to see how lychee is resolving paths:
0 commit comments