Skip to content

Commit

Permalink
Merge pull request #35 from HiDeoo/hd-fix-trailing-slash-home
Browse files Browse the repository at this point in the history
  • Loading branch information
HiDeoo authored Mar 29, 2024
2 parents 0b0a64a + c9001ab commit 57d91ff
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/starlight-links-validator/libs/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,9 @@ function validateLink(context: ValidationContext) {
}

if (
(astroConfig.trailingSlash === 'always' && !path.endsWith('/')) ||
(astroConfig.trailingSlash === 'never' && path.endsWith('/'))
path.length > 0 &&
((astroConfig.trailingSlash === 'always' && !path.endsWith('/')) ||
(astroConfig.trailingSlash === 'never' && path.endsWith('/')))
) {
addError(errors, filePath, link, ValidationErrorType.TrailingSlash)
return
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Home
---

This is the home page.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ title: Test

- [External link](https://starlight.astro.build/)

- [Honme page](/)

- [Example page](/guides/example)
- [Example page](/guides/example/)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Home
---

This is the home page.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ title: Test

- [External link](https://starlight.astro.build/)

- [Honme page](/)

- [Example page](/guides/example)
- [Example page](/guides/example/)

Expand Down

0 comments on commit 57d91ff

Please sign in to comment.