Skip to content

Commit

Permalink
Merge pull request #451 from levirs565/pretty_relative
Browse files Browse the repository at this point in the history
Relative URL Plugin Not Work when Pretty URL is disabled.
  • Loading branch information
oscarotero committed Jul 24, 2023
2 parents 598e74f + e1b221e commit b10f23a
Show file tree
Hide file tree
Showing 4 changed files with 401 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ and this project try to adheres to [Semantic Versioning](https://semver.org/),
but not always is possible (due the use of unstable features from Deno).
Any BREAKING CHANGE between minor versions will be documented here in upper case.

## Unreleased

### Fixed
- `relative_urls` give wrong URL when `prettyUrls` is disabled

## [1.18.2] - 2023-07-21
### Added
- `slugify_urls` plugin is applied also to static files [#447].
Expand Down
3 changes: 2 additions & 1 deletion plugins/relative_urls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ export default function () {
}

const from = site.url(page.data.url as string);
return posix.relative(from, url);
if (site.options.prettyUrls) return posix.relative(from, url);
else return posix.join("./", posix.relative(posix.dirname(from), url));
},
}));
};
Expand Down
Loading

0 comments on commit b10f23a

Please sign in to comment.