Fix #891 - Adding site-wide and locale-specific support for changing the logo link #1015
+65
−1
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.
Summary
This PR adds support for the feature requested in #891 : adding the option to change the link to which the user is directed when clicking the logo.
I ran across this issue on my own VuePress site: I'm keeping the default base URL (
/
), but have no content at/
, only at/terms
,/privacy
, etc. We actually host a completely different app at the root of our domain, and handle routing to that app using Cloudfront cache behaviors. Specifically,Since the
router-link
tied to the logo currently does client-side routing to/
, and since I have no content at/
, users get a404
. Since I'm handling routing at the Cloudfront-level, I need to direct users to the external URL pointing them to our app (in the example above,https://domain.com
).My use case was to change the
logoLink
on a site-wide level, so I've added support for including a URL at$site.themeConfig.logoLink
. In the absence of this property, the logo link falls back to the$localePath
(existing behavior).I also thought it would be nice to add locale-specific logo links, so I first check for the presence of
$themeLocaleConfig.logoLink
, then$site.themeConfig.logoLink
, then$localePath
.I've tested this manually but extensively. Since this is my first VuePress commit, I'm sure I'm missing something, so I'm definitely open to feedback.
What kind of change does this PR introduce? (check at least one)
Does this PR introduce a breaking change? (check one)
If yes, please describe the impact and migration path for existing applications:
The PR fulfills these requirements:
fix #xxx[,#xxx]
, where "xxx" is the issue number)You have tested in the following browsers: (Providing a detailed version will be better.)
All tests done on macOS 10.14
If adding a new feature, the PR's description includes:
I didn't see any existing tests for the relevant code, but I'm happy to add / update those tests if you'd like.