Skip to content
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
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update validUrl method, replace method with computed value in template
  • Loading branch information
TishG committed Jan 27, 2022
commit 43b2dcf26853b04fd925db2114998946fcd4c265
12 changes: 11 additions & 1 deletion src/libraries/utils.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
/**
* Verifies whether the url starts with http:https:// 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:https://") === 0
}

/**
* Our CMS does not validate urls,
* urls are entered in manually by the author,
Expand All @@ -11,7 +21,7 @@
const https = "https://";
const trimmedUrl = url.trim();

if (trimmedUrl.includes(https) || trimmedUrl.includes("http:https://")) {
if (isValidUrl(trimmedUrl)) {
return trimmedUrl;
}
return https + trimmedUrl;
Expand Down
11 changes: 9 additions & 2 deletions src/pages/About.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,16 @@ export default {
metaInfo: {
title: "About us",
},
methods: {
methods: {
validUrl
}

// methods: {
// validUrl
// },
// computed: {
// portfolioUrl() {
// // return this.validUrl(member.node.contact_links.portfolio_url)
// }
// }
Comment on lines +97 to +104
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Remove these unused methods.

};
</script>
7 changes: 6 additions & 1 deletion src/templates/Biopost.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
>
<a
v-if="$page.biopost.contact_links.portfolio_url"
:href="validUrl($page.biopost.contact_links.portfolio_url)"
:href="portfolioUrl"
class="font-bold underline"
>Portfolio</a
>
Expand Down Expand Up @@ -72,6 +72,11 @@ export default {
},
methods: {
validUrl
},
computed: {
portfolioUrl() {
return this.validUrl(this.$page.biopost.contact_links.portfolio_url)
}
}
};
</script>
Expand Down