@icvdeveloper/common-module 0.0.115 → 0.0.117

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "v3plus-common-module",
3
3
  "configKey": "v3plusCommonModule",
4
- "version": "0.0.115"
4
+ "version": "0.0.117"
5
5
  }
@@ -1,7 +1,7 @@
1
1
  import { defineNuxtPlugin } from "#app";
2
2
  import { computed } from "vue";
3
3
  import { storeToRefs } from "pinia";
4
- import { find } from "lodash-es";
4
+ import { get, find } from "lodash-es";
5
5
  import NProgress from "nprogress";
6
6
  import piniaPluginPersistedstate from "pinia-plugin-persistedstate";
7
7
  import { createV3plusCommonPlugin } from "./v3plusCommonPlugin.mjs";
@@ -32,6 +32,12 @@ export default defineNuxtPlugin((nuxtApp) => {
32
32
  const { data: navigation } = storeToRefs(
33
33
  useNavigationConfigStore()
34
34
  );
35
+ const stripHtml = (html) => {
36
+ const div = document.createElement("div");
37
+ div.innerHTML = html;
38
+ const text = div.textContent || div.innerText || "";
39
+ return text;
40
+ };
35
41
  let docTitle = "Rubicon";
36
42
  let docSubtitle = "";
37
43
  let routeArray = to.name.toLowerCase().split("-");
@@ -73,7 +79,12 @@ export default defineNuxtPlugin((nuxtApp) => {
73
79
  presentationsStore.selectedPresentation = null;
74
80
  }
75
81
  if (!docSubtitle && to.name != "index") {
76
- let navObj = find(navigation.value, { "url": to.path });
82
+ let navObj = find(
83
+ navigation.value,
84
+ function(nav) {
85
+ return nav.slug == to.name || nav.url == to.path;
86
+ }
87
+ );
77
88
  if (navObj) {
78
89
  docSubtitle += `${navObj.label}`;
79
90
  } else {
@@ -88,6 +99,29 @@ export default defineNuxtPlugin((nuxtApp) => {
88
99
  if (docSubtitle)
89
100
  docTitle += ` | ${docSubtitle}`;
90
101
  document.title = docTitle;
102
+ let canonicalUrl = "https://" + portal.value.domain + to.path;
103
+ if (document.querySelector("link[rel='canonical']")) {
104
+ document.querySelector("link[rel='canonical']").setAttribute("href", canonicalUrl);
105
+ } else {
106
+ let canonicalTag = document.createElement("link");
107
+ canonicalTag.rel = "canonical";
108
+ canonicalTag.href = canonicalUrl;
109
+ document.querySelector("head").appendChild(canonicalTag);
110
+ }
111
+ let metaDesc = portal.value.description;
112
+ if (get(presentationsStore, "selectedPresentation.description.length", 0) > 0) {
113
+ metaDesc = stripHtml(presentationsStore.selectedPresentation.description);
114
+ } else if (get(conferencesStore, "selectedConference.description.length", 0) > 0) {
115
+ metaDesc = stripHtml(conferencesStore.selectedConference.description);
116
+ }
117
+ if (document.querySelector("meta[name='description']")) {
118
+ document.querySelector("meta[name='description']").setAttribute("content", metaDesc);
119
+ } else {
120
+ let metaTag = document.createElement("meta");
121
+ metaTag.name = "description";
122
+ metaTag.content = metaDesc;
123
+ document.querySelector("head").appendChild(metaTag);
124
+ }
91
125
  });
92
126
  nuxtApp.$router.afterEach(() => {
93
127
  NProgress.done();
@@ -101,9 +135,6 @@ export default defineNuxtPlugin((nuxtApp) => {
101
135
  app.config.globalProperties.$head.addHeadObjs(
102
136
  computed(() => {
103
137
  return {
104
- meta: [
105
- { name: "description", content: portal.value.description }
106
- ],
107
138
  link: [
108
139
  {
109
140
  rel: "icon",
@@ -14,7 +14,7 @@ export const usePortalStore = defineStore("portal", {
14
14
  return new Promise((resolve, reject) => {
15
15
  this.loading = true;
16
16
  request(
17
- "portals/1?fields=id,name,description,favicon,ga_id,gtm_id,adobe_launch_url&with=template_config,navigation_config"
17
+ "portals/1?fields=id,name,description,domain,favicon,ga_id,gtm_id,adobe_launch_url&with=template_config,navigation_config"
18
18
  ).then((response) => {
19
19
  const {
20
20
  data: { navigation_config, template_config, ...data }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icvdeveloper/common-module",
3
- "version": "0.0.115",
3
+ "version": "0.0.117",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {