refactor: dnry - use media-url.html#2649
Closed
dolfs wants to merge 2 commits intocotes2020:masterfrom
Closed
Conversation
When baseurl in _config.yml is not empty, without this fix, it can be prepended more than once, which is incorrect. This fix adds logic to prevent prepending the baseurl when it is already a prefix in the url, but correctly handles cases where it is a prefix, but the url does not follow this prefix with a path/url separator. For example, when baseurl is set to /blog, but the url starts with /blogger it is not considered "prefixed" and /blog/ is prepended (resulting in /blog/blogger…, but if the url starts with /blog/it is considered "prefixed" and is not prepended again (keeping/resulting in/blog/…`) A limitation is that if the user supplied a (partial) URL starting with /blog/ and truly intended to produce /blog/blog/, it won't work. Fixes: cotes2020#2639 Signed-off-by: Dolf Starreveld <registration@starreveld.com>
…riately Both home and post layouts did some of the work already done by _include/media-url.html. Since that _include was fixed to deal with the double prepend of baseurl, these layouts still had the problem. Change that so they use the include. Only effective when the previous PR is also merged. depends-on: PR cotes2020#2648 Signed-off-by: Dolf Starreveld <registration@starreveld.com>
|
Oops, it seems you've opened an invalid pull request. No worries, we'll close it for you. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of change
Description
There was code in the post and home layouts that, in part, duplicated the work done in media-url.html. Instead they should use that include (DNRY principle) to also get the benefit of the fixes in #2389.
Additional context
depends-on: PR #2648