Search...
seoMarkup
Sets or gets the SEO markup to be rendered for search engine bots.
Description
Use the seoMarkup
property to write HTML content that will be served to Google and other search engines. This is necessary because some bots cannot process the JavaScript content of the custom element.
If you do not add the equivalent HTML of the custom element's implementation using this SEO markup property, only bots that index JavaScript, such as Google, will be able to index the custom element's content/markup for search engine results.
Note: It is the user's responsibility to handle all aspects of SEO for the element, including managing the validity of the SEO markup opposite search engines.
Type:
stringRead & Write
Was this helpful?
Set SEO markup for the custom element
Copy Code
1// **********************************************2// Custom Element Code in Velo3// **********************************************45// Set the HTML content for SEO markup6// to be used by search engines.7// Make sure the SEO markup matches the8// contents of the custom9// element exactly so as not to mislead10// web crawlers.1112$w('#myCustomElement').seoMarkup = 'Hello World!';131415// **********************************************16// Custom Element Implementation on an HTML Page17// **********************************************1819class MyElement extends HTMLElement {20 connectedCallback() {21 this.innerHTML = 'Hello World!'22 }23}24customElements.define('my-custom-element', MyElement);252627// ***************************************************************28// Custom Element's Result (both for SEO bots and non-SEO traffic)29// ***************************************************************30<my-custom-element>Hello World!</my-custom-element>