You are here

seoHrefLang

Used by the following Containers: 
Variable Type: 
Custom Javascript
Grabs all hreflang tags in the page and makes a object with it
	function() {
  	// grabing the content of all hreflang tags
	// <link rel="alternate" hreflang="XXXXX" href="XXXXXX" />
	var linksInHead = document.head.getElementsByTagName('link');
  	var linksInHeadLength = linksInHead.length;
    var SEOHrefLang = [];
  	
  	var i;
    for ( i = 0; i < linksInHeadLength; i++ ) {
      	var hrefLang = '';
        var href = '';
    	if (linksInHead[i].rel == 'alternate' && linksInHead[i].hreflang != '') {
			hrefLang = linksInHead[i].hreflang ;
          	href = linksInHead[i].href ;
          	SEOHrefLang.push({ 'hreflang': hrefLang,
                               'href': href
                             })
          	
        }   
    }
  	return SEOHrefLang;
}