-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Portfolio site leads to 404 #149
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8af0d16
add libraries folder, add utils file to libraries folder
TishG 78113f7
add validPortfolioUrl util function to utils
TishG f11297d
add jsdoc and import and use validUrl function in About and Biopost
TishG c01080d
update validUrl function
TishG 43b2dcf
Update validUrl method, replace method with computed value in template
TishG File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* Verifies whether the url starts with http:// or https:// | ||
* @function | ||
* @param {string} url - The url of the portfolio site | ||
* @returns {boolean} | ||
*/ | ||
const isValidUrl = (url) => { | ||
return url.indexOf("https://") === 0 || url.indexOf("http://") === 0 | ||
} | ||
|
||
/** | ||
* Our CMS does not validate urls, | ||
* urls are entered in manually by the author, | ||
* so this is to ensure a valid url to navigate to | ||
* @function | ||
* @param {string} url - The url of the portfolio site | ||
* @returns {string} url - The passed in url or a new url | ||
* with https appended to it | ||
*/ | ||
export const validUrl = (url = "") => { | ||
const https = "https://"; | ||
const trimmedUrl = url.trim(); | ||
|
||
if (isValidUrl(trimmedUrl)) { | ||
return trimmedUrl; | ||
} | ||
return https + trimmedUrl; | ||
}; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,7 +47,7 @@ | |
<a | ||
class="ml-auto text-xl font-extrabold" | ||
v-if="member.node.contact_links.portfolio_url" | ||
:href="member.node.contact_links.portfolio_url" | ||
:href="validUrl(member.node.contact_links.portfolio_url)" | ||
>site</a | ||
> | ||
</article> | ||
|
@@ -86,9 +86,21 @@ query | |
</page-query> | ||
|
||
<script> | ||
import {validUrl} from "../libraries/utils"; | ||
export default { | ||
metaInfo: { | ||
title: "About us", | ||
}, | ||
methods: { | ||
validUrl | ||
} | ||
// methods: { | ||
// validUrl | ||
// }, | ||
// computed: { | ||
// portfolioUrl() { | ||
// // return this.validUrl(member.node.contact_links.portfolio_url) | ||
// } | ||
// } | ||
Comment on lines
+97
to
+104
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: Remove these unused methods. |
||
}; | ||
</script> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,13 +16,13 @@ | |
/> | ||
<a | ||
v-if="$page.biopost.contact_links.email" | ||
:href="`mailto:${$page.biopost.contact_links.email}`" | ||
href="`mailto:${$page.biopost.contact_links.email}`" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think here we still want the email to be dynamic, so keep the |
||
class="font-bold underline" | ||
>Email</a | ||
> | ||
<a | ||
v-if="$page.biopost.contact_links.portfolio_url" | ||
:href="$page.biopost.contact_links.portfolio_url" | ||
:href="portfolioUrl" | ||
class="font-bold underline" | ||
>Portfolio</a | ||
> | ||
|
@@ -63,12 +63,21 @@ | |
</template> | ||
|
||
<script> | ||
import {validUrl} from "../libraries/utils"; | ||
export default { | ||
metaInfo() { | ||
return { | ||
title: this.$page.biopost.title, | ||
}; | ||
}, | ||
methods: { | ||
validUrl | ||
}, | ||
computed: { | ||
portfolioUrl() { | ||
return this.validUrl(this.$page.biopost.contact_links.portfolio_url) | ||
} | ||
} | ||
}; | ||
</script> | ||
|
||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Compliment: I like your explanation here, it gives great context.