Sets the page's SEO-related link tags.
Use the setLinks()
function to set a page's SEO-related link tags which provide additional
SEO information about your page. For example, you can set a link to a canonical
or alternate version of the current page.
The links you set overwrite any link information set earlier.
Notes:
You should always set the links inside the onReady()
event handler to ensure search engines can read it.
You cannot add a stylesheet link using the setLinks
function.
function setLinks(links: Array<Link>): Promise<void>;
The links to set.
import wixSeoFrontend from "wix-seo-frontend";
// ...
$w.onReady(() => {
wixSeoFrontend
.setLinks([
{
rel: "canonical",
href: "http://mysite.com/cononical_version",
},
{
rel: "author",
href: "http://mysite.com/janedoe",
},
])
.then(() => {
console.log("links set");
})
.catch(() => {
console.log("failed setting links");
});
});
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.