I have a custom webpart which acts as a 'dashboard' showing product information on a subsite, and it needs to include a direct link to another subsite within the same site collection. Whenever I try to include a link, however, Sharepoint appends it to the existing site url.
The webpart uses ReactJS and REST to recall product information from a list on the parent site. The js file is referenced to via a Content Editor web part.
For example, I have the subsite "Project1" that I want to link to the "Project1A" subsite. Using javascript, I set up the html to render as:
<a href="https://sitename.sharepoint.com/sites/sitecollection/Project1A">
But the actual link that renders when the page loads reads: sitename.sharepoint.com/sites/sitecollection/Project1/"https://sitename.sharepoint.com/sites/sitecollection/Project1A"
What is the correct way to add a direct link?
To help clarify, here's a snippet of my code where the link is generated (the URL is changed to protect my business' identity:
render(){
debugger;
return (
<div>
{this.state.items.map(function(item,key){
console.log(item)
var editLink = '"https://sitename.sharepoint.com/sites/sitecollection/project1A"';
console.log(editLink)
return (
// Custom HTML to render Product Info Panel
<div style={divContainer} key={key}>
<div style={divProductinfo}>
<h1 style={h1Producttitle}>{item.Title}</h1>
<a href={editLink}><div style={divEdit}>Edit</div></a><br></br>
<a href="https://sitename.sharepoint.com/sites/sitecollection/Project1A">
– Gautam Sheth Oct 24 '17 at 10:49