siteMapPerso
Changes
src/mySiteMap.js 94(+54 -40)
Details
src/mySiteMap.js 94(+54 -40)
diff --git a/src/mySiteMap.js b/src/mySiteMap.js
index ace8934..7f13227 100644
--- a/src/mySiteMap.js
+++ b/src/mySiteMap.js
@@ -1,4 +1,3 @@
-
let enviroment = "";
let pages = []
@@ -223,49 +222,65 @@ if (validarParteDeURL(window.location.href, "MercadosOnline") && !validarParteDe
}
if (document.querySelector("#pagecontent .news") || document.querySelector("#pagecontent .news-minisite") || document.querySelector("#pagecontent .news-es") || document.querySelector("#pagecontent .news-mx")) {
+
+
+
const metaTag = document.querySelector('meta[property="og:image"]');
- let interaction = {
- name: SalesforceInteractions.CatalogObjectInteractionName.ViewCatalogObject,
- catalogObject: {
- type: "Article",
- id: window.cronistaDataLayer[0].articleProperty.id,
- attributes: {
- url: window.location.href,
- name: SalesforceInteractions.resolvers.fromSelector("#content-title"),
- description: SalesforceInteractions.resolvers.fromSelector(".description"),
- imageUrl: metaTag ? metaTag.getAttribute('content') : null,
- articleId: window.cronistaDataLayer[0].articleProperty.id.toString(),
- seccion: window.cronistaDataLayer[0].articleProperty.category,
- articleTitle: SalesforceInteractions.resolvers.fromSelector("#content-title"),
- publishDate: SalesforceInteractions.resolvers.fromSelector(".author-date time"),
- authorName: window.cronistaDataLayer[0].articleProperty.authorName,
- canonicalUrl: window.cronistaDataLayer[0].articleProperty.canonica,
- accessCondition: window.cronistaDataLayer[0].articleProperty.conditionsOfAccess
- },
- relatedCatalogObjects: {
- Category: SalesforceInteractions.DisplayUtils.pageElementLoaded(
- "html",
- ).then((ele) => {
- return [window.cronistaDataLayer[0].articleProperty.category.toUpperCase()]
- }),
- Autores: SalesforceInteractions.DisplayUtils.pageElementLoaded(
- "html",
- ).then((ele) => {
- return [window.cronistaDataLayer[0].articleProperty.authorName.toUpperCase()]
- }),
- CondicionDeAcceso: SalesforceInteractions.DisplayUtils.pageElementLoaded(
- "html",
- ).then((ele) => {
- return [window.cronistaDataLayer[0].articleProperty.conditionsOfAccess.toUpperCase()]
- }),
+ console.log(metaTag)
+ if (metaTag != null) {
+ let interaction = {
+ name: SalesforceInteractions.CatalogObjectInteractionName.ViewCatalogObject,
+ catalogObject: {
+ type: "Article",
+ id: window.cronistaDataLayer[0].articleProperty.id,
+ attributes: {
+ url: window.location.href,
+ name: SalesforceInteractions.resolvers.fromSelector("#content-title"),
+ description: SalesforceInteractions.resolvers.fromSelector(".description"),
+ imageUrl: metaTag ? metaTag.getAttribute('content') : "https://www.cronista.com/files/image/514/514552/63fffa1910bdd.png",
+ articleId: window.cronistaDataLayer[0].articleProperty.id.toString(),
+ seccion: window.cronistaDataLayer[0].articleProperty.category,
+ articleTitle: SalesforceInteractions.resolvers.fromSelector("#content-title"),
+ publishDate: SalesforceInteractions.resolvers.fromSelector(".author-date time"),
+ authorName: window.cronistaDataLayer[0].articleProperty.authorName,
+ canonicalUrl: window.cronistaDataLayer[0].articleProperty.canonica,
+ accessCondition: window.cronistaDataLayer[0].articleProperty.conditionsOfAccess
+ },
+ relatedCatalogObjects: {
+ Category: SalesforceInteractions.DisplayUtils.pageElementLoaded(
+ "html",
+ ).then((ele) => {
+ return [window.cronistaDataLayer[0].articleProperty.category.toUpperCase()]
+ }),
+ Autores: SalesforceInteractions.DisplayUtils.pageElementLoaded(
+ "html",
+ ).then((ele) => {
+ return [window.cronistaDataLayer[0].articleProperty.authorName.toUpperCase()]
+ }),
+ CondicionDeAcceso: SalesforceInteractions.DisplayUtils.pageElementLoaded(
+ "html",
+ ).then((ele) => {
+ return [window.cronistaDataLayer[0].articleProperty.conditionsOfAccess.toUpperCase()]
+ }),
+ },
},
- },
+ }
+ let article = new PageType("Article", window.location.href, interaction, articleListeners, document.querySelector("#pagecontent .news"));
+ pages.push(article)
+ }
+}
+
+function noTieneClase(elemento, clase) {
+ if (elemento) { // Verifica si el elemento no es null
+ return !elemento.classList.contains(clase);
+ } else {
+ console.error('El elemento es null o no existe en el DOM.');
+ return false; // O lanza un error, según lo que necesites
}
- let article = new PageType("Article", window.location.href, interaction, articleListeners, document.querySelector("#pagecontent .news"));
- pages.push(article)
}
+
//Función que devuelve el array con las info de las pageType
/*[home, payWall, article, logInWall, landingDolar, mercadosOnline, confirmacionOnAir,
streamingExclusivo, suscriptionsForm, suscriptionsConfirm, landingEventosGeneral, landingEventos]*/
@@ -604,5 +619,4 @@ SalesforceInteractions.init({
pageTypes: Pages()
};
SalesforceInteractions.initSitemap(sitemapConfig);
-});
-
+});
\ No newline at end of file