@eox/pages-theme-esa 0.4.1 → 0.5.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eox/pages-theme-esa",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "description": "Vitepress Theme with ESA branding",
6
6
  "main": "src/index.js",
package/src/Layout.vue CHANGED
@@ -10,19 +10,22 @@ const router = useRouter();
10
10
 
11
11
  onMounted(async () => {
12
12
  setTimeout(() => {
13
- document.querySelector("esa-cookies").addEventListener("accept", () => {
14
- _paq.push(["rememberCookieConsentGiven"]);
15
- });
16
- document.querySelector("esa-cookies").addEventListener("decline", () => {
17
- _paq.push(["forgetCookieConsentGiven"]);
18
- _paq.push(["optUserOut"]);
19
- });
13
+ const cookieBanner = document.querySelector("esa-cookies");
14
+ if (cookieBanner) {
15
+ cookieBanner.addEventListener("accept", () => {
16
+ _paq.push(["rememberCookieConsentGiven"]);
17
+ });
18
+ cookieBanner.addEventListener("decline", () => {
19
+ _paq.push(["forgetCookieConsentGiven"]);
20
+ _paq.push(["optUserOut"]);
21
+ });
20
22
 
21
- if (
22
- !document.cookie.includes("mtm_cookie_consent") &&
23
- !document.cookie.includes("mtm_consent_removed")
24
- ) {
25
- document.querySelector("esa-cookies").style.display = "block";
23
+ if (
24
+ !document.cookie.includes("mtm_cookie_consent") &&
25
+ !document.cookie.includes("mtm_consent_removed")
26
+ ) {
27
+ cookieBanner.style.display = "block";
28
+ }
26
29
  }
27
30
 
28
31
  // TRACK PAGE SCROLL
@@ -60,12 +63,17 @@ onMounted(async () => {
60
63
  }
61
64
  };
62
65
 
63
- watch(() => router.route.data.relativePath, () => {
64
- _paq.push(['setCustomUrl', router.route.path]);
65
- _paq.push(['setDocumentTitle', router.route.data.title]);
66
- _paq.push(['trackPageView']);
67
- _paq.push(['enableLinkTracking']);
68
- }, { immediate: true });
66
+ watch(
67
+ () => router.route.data.relativePath,
68
+ () => {
69
+ if (!window._paq) return;
70
+ _paq.push(["setCustomUrl", router.route.path]);
71
+ _paq.push(["setDocumentTitle", router.route.data.title]);
72
+ _paq.push(["trackPageView"]);
73
+ _paq.push(["enableLinkTracking"]);
74
+ },
75
+ { immediate: true },
76
+ );
69
77
 
70
78
  applyShadowDomEventListener(
71
79
  [
@@ -93,13 +101,13 @@ onMounted(async () => {
93
101
  <ClientOnly>
94
102
  <slot name="layout-top"></slot>
95
103
  <esa-menu
96
- .menuItems="theme.nav.map(n => ({title: n.text, href: n.link}))"
104
+ .menuItems="theme.nav.map((n) => ({ title: n.text, href: n.link }))"
97
105
  :enable-login="theme.login"
98
106
  ></esa-menu>
99
107
  <esa-header></esa-header>
100
108
  <esa-navbar
101
109
  :brand-title="site.title"
102
- .menuItems="theme.nav.map(n => ({title: n.text, href: n.link}))"
110
+ .menuItems="theme.nav.map((n) => ({ title: n.text, href: n.link }))"
103
111
  :enable-login="theme.login"
104
112
  ></esa-navbar>
105
113
  </ClientOnly>
@@ -111,92 +119,90 @@ onMounted(async () => {
111
119
  :title="frontmatter.hero.text"
112
120
  :background-image="frontmatter.hero.image"
113
121
  :underline="frontmatter.hero.tagline"
114
- cta
115
- :cta-link="frontmatter.hero.actions[0].link"
116
- :cta-text="frontmatter.hero.actions[0].text"
122
+ :cta="frontmatter.hero.actions?.[0]"
123
+ :cta-link="frontmatter.hero.actions?.[0]?.link"
124
+ :cta-text="frontmatter.hero.actions?.[0]?.text"
117
125
  ></esa-cover>
118
126
  </ClientOnly>
119
127
  </template>
120
128
  <template #layout-bottom>
121
129
  <ClientOnly>
122
130
  <esa-gateway
123
- .items='[
124
- {
125
- title: "ESA Vision",
126
- links: [
127
- {
128
- name: "EO Science Strategy",
129
- href: "https://doi.org/10.5281/zenodo.13819557",
130
- },
131
- ],
132
- },
133
- {
134
- title: "ESA EO Programme",
135
- links: [
136
- {
137
- name: "Observing the Earth",
138
- href: "https://www.esa.int/Applications/Observing_the_Earth",
139
- },
140
- {
141
- name: "Science for Society",
142
- href: "https://eo4society.esa.int",
143
- },
144
- ],
145
- },
146
- {
147
- title: "Research at ESA",
148
- links: [
149
-
131
+ .items="[
150
132
  {
151
- name: "Earth System Science Hub",
152
- href: "https://sciencehub.esa.int",
133
+ title: 'ESA Vision',
134
+ links: [
135
+ {
136
+ name: 'EO Science Strategy',
137
+ href: 'https://doi.org/10.5281/zenodo.13819557',
138
+ },
139
+ ],
153
140
  },
154
- ],
155
- },
156
- {
157
- title: "Opportunities",
158
- links: [
159
-
160
141
  {
161
- name: "Network of Resources",
162
- href: "https://nor-discover.org",
142
+ title: 'ESA EO Programme',
143
+ links: [
144
+ {
145
+ name: 'Observing the Earth',
146
+ href: 'https://www.esa.int/Applications/Observing_the_Earth',
147
+ },
148
+ {
149
+ name: 'Science for Society',
150
+ href: 'https://eo4society.esa.int',
151
+ },
152
+ ],
163
153
  },
164
- ],
165
- },
166
- ]'
154
+ {
155
+ title: 'Research at ESA',
156
+ links: [
157
+ {
158
+ name: 'Earth System Science Hub',
159
+ href: 'https://sciencehub.esa.int',
160
+ },
161
+ ],
162
+ },
163
+ {
164
+ title: 'Opportunities',
165
+ links: [
166
+ {
167
+ name: 'Network of Resources',
168
+ href: 'https://nor-discover.org',
169
+ },
170
+ ],
171
+ },
172
+ ]"
167
173
  ></esa-gateway>
168
174
  <esa-footer
169
175
  title="Get in touch"
170
176
  description="Join ESA's initiative to ensure long-term preservation and accessibility of research data, code, and documentation for a global scientific community."
171
- contact-link="mailto:earthcode@esa.int"
177
+ contact-link="mailto:earth-code@esa.int"
172
178
  .footerItems="[
173
- [
174
- {
175
- href: 'https://www.esa.int/',
176
- title: 'ESA Portal',
177
- },
178
- {
179
- href: 'https://www.esa.int/About_Us/Corporate_news',
180
- title: 'About ESA',
181
- },
182
- ],
183
- [
184
- {
185
- href: 'https://www.esa.int/Services/Terms_and_conditions',
186
- title: 'Terms and Conditions',
187
- },
188
- {
189
- href: 'https://www.esa.int/Services/Cookies_notice',
190
- title: 'Cookies Notice',
191
- },
192
- ],
193
- [
194
- {
195
- href: 'https://www.esa.int/Services/Privacy_notice',
196
- title: 'Privacy Notice',
197
- },
198
- ],
199
- ]"
179
+ [
180
+ {
181
+ href: 'https://www.esa.int/',
182
+ title: 'ESA Portal',
183
+ },
184
+ {
185
+ href: 'https://www.esa.int/About_Us/Corporate_news',
186
+ title: 'About ESA',
187
+ },
188
+ ],
189
+ [
190
+ {
191
+ href: 'https://www.esa.int/Services/Terms_and_conditions',
192
+ title: 'Terms and Conditions',
193
+ },
194
+ {
195
+ href: 'https://www.esa.int/Services/Cookies_notice',
196
+ title: 'Cookies Notice',
197
+ },
198
+ ],
199
+ [
200
+ {
201
+ href: 'https://www.esa.int/Services/Privacy_notice',
202
+ title: 'Privacy Notice',
203
+ },
204
+ ],
205
+ ]"
200
206
  ></esa-footer>
201
207
  <esa-cookies
202
208
  link="https://www.esa.int/Services/Cookies_notice"
@@ -1,13 +1,19 @@
1
1
  <script setup>
2
2
  import { data as blogposts } from "../blogposts.data.js";
3
+
4
+ const props = defineProps({
5
+ maxPosts: { type: Number, default: Infinity },
6
+ });
3
7
  </script>
4
8
 
5
9
  <template>
6
10
  <esa-cards>
7
11
  <esa-card
8
- v-for="(blogpost, index) in blogposts.sort((a, b) =>
9
- new Date(a.frontmatter.date) < new Date(b.frontmatter.date) ? 1 : -1,
10
- )"
12
+ v-for="(blogpost, index) in blogposts
13
+ .sort((a, b) =>
14
+ new Date(a.frontmatter.date) < new Date(b.frontmatter.date) ? 1 : -1,
15
+ )
16
+ .slice(0, props.maxPosts)"
11
17
  :feature="blogpost.frontmatter.feature"
12
18
  overline="Story"
13
19
  :image="blogpost.frontmatter.image"
Binary file