@icvdeveloper/common-module 0.0.115 → 0.0.116

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.116"
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("-");
@@ -72,6 +78,8 @@ export default defineNuxtPlugin((nuxtApp) => {
72
78
  } else {
73
79
  presentationsStore.selectedPresentation = null;
74
80
  }
81
+ console.log("to", to);
82
+ console.log("navigation", navigation.value);
75
83
  if (!docSubtitle && to.name != "index") {
76
84
  let navObj = find(navigation.value, { "url": to.path });
77
85
  if (navObj) {
@@ -88,6 +96,29 @@ export default defineNuxtPlugin((nuxtApp) => {
88
96
  if (docSubtitle)
89
97
  docTitle += ` | ${docSubtitle}`;
90
98
  document.title = docTitle;
99
+ let canonicalUrl = "https://" + portal.value.domain + to.path;
100
+ if (document.querySelector("link[rel='canonical']")) {
101
+ document.querySelector("link[rel='canonical']").setAttribute("href", canonicalUrl);
102
+ } else {
103
+ let canonicalTag = document.createElement("link");
104
+ canonicalTag.rel = "canonical";
105
+ canonicalTag.href = canonicalUrl;
106
+ document.querySelector("head").appendChild(canonicalTag);
107
+ }
108
+ let metaDesc = portal.value.description;
109
+ if (get(presentationsStore, "selectedPresentation.description.length", 0) > 0) {
110
+ metaDesc = stripHtml(presentationsStore.selectedPresentation.description);
111
+ } else if (get(conferencesStore, "selectedConference.description.length", 0) > 0) {
112
+ metaDesc = stripHtml(conferencesStore.selectedConference.description);
113
+ }
114
+ if (document.querySelector("meta[name='description']")) {
115
+ document.querySelector("meta[name='description']").setAttribute("content", metaDesc);
116
+ } else {
117
+ let metaTag = document.createElement("meta");
118
+ metaTag.name = "description";
119
+ metaTag.content = metaDesc;
120
+ document.querySelector("head").appendChild(metaTag);
121
+ }
91
122
  });
92
123
  nuxtApp.$router.afterEach(() => {
93
124
  NProgress.done();
@@ -101,9 +132,6 @@ export default defineNuxtPlugin((nuxtApp) => {
101
132
  app.config.globalProperties.$head.addHeadObjs(
102
133
  computed(() => {
103
134
  return {
104
- meta: [
105
- { name: "description", content: portal.value.description }
106
- ],
107
135
  link: [
108
136
  {
109
137
  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.116",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {