-
Notifications
You must be signed in to change notification settings - Fork 64
Expand file tree
/
Copy pathhead.html
More file actions
158 lines (136 loc) · 5.76 KB
/
head.html
File metadata and controls
158 lines (136 loc) · 5.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
body {
display: none;
}
.reading-width {
max-width: 800px;
margin: auto;
padding: 20px;
}
.reading-width-footer-tag {
max-width: 800px;
margin: -20px auto;
padding: 0 20px 20px;
}
.reading-width-footer-tag > .content {
max-width: var(--grid-container-width);
margin: 0 auto;
}
/* TODO: Remove once style is handled in merch */
:root:has(meta[name='theme'][content='max25']) {
@media screen and (max-width: 767px) {
.two-merch-cards.mini-compare-chart,
.three-merch-cards.mini-compare-chart,
.four-merch-cards.mini-compare-chart {
grid-template-columns: 310px;
}
}
@media screen and (min-width: 768px) {
.three-merch-cards.mini-compare-chart,
.four-merch-cards.mini-compare-chart {
grid-template-columns: repeat(2, 310px);
}
}
@media screen and (min-width: 1200px) {
.three-merch-cards.mini-compare-chart,
.four-merch-cards.mini-compare-chart {
grid-template-columns: repeat(3, 310px);
}
}
@media screen and (min-width: 1600px) {
.four-merch-cards.mini-compare-chart {
grid-template-columns: repeat(4, 336px);
}
}
}
</style>
<script src="/creativecloud/plans/scripts/fallback.js" nomodule></script>
<script type="module">
const userAgentMeta = document.querySelector('meta[name="hreflinksuseragents"]');
const allowedAgents = userAgentMeta && userAgentMeta.content.split(',');
const userAgentString = window.navigator.userAgent;
const isAllowedAgent = allowedAgents && allowedAgents.some((agent) => userAgentString.includes(agent.trim()));
const ssrFlag = document.querySelector('meta[name="head-loaded"]');
const LOCALES = ['ae_ar', 'ae_en', 'africa', 'ar', 'at', 'au', 'be_en', 'be_fr', 'be_nl', 'bg', 'br', 'ca_fr', 'ca', 'ch_de', 'ch_fr', 'ch_it', 'cl', 'cn', 'co', 'cr', 'cy_en', 'cz', 'de', 'dk', 'ec', 'ee', 'eg_ar', 'eg_en', 'el', 'es', 'fi', 'fr', 'gr_el', 'gr_en', 'gt', 'hk_en', 'hk_zh', 'hu', 'id_en', 'id_id', 'ie', 'il_en', 'il_he', 'in_hi', 'in', 'it', 'jp', 'kr', 'kw_ar', 'kw_en', 'la', 'lt', 'lu_de', 'lu_en', 'lu_fr', 'lv', 'mena_ar', 'mena_en', 'mt', 'mx', 'my_en', 'my_ms', 'ng', 'nl', 'no', 'nz', 'pe', 'ph_en', 'ph_fil', 'pl', 'pr', 'pt', 'qa_ar', 'qa_en', 'ro', 'ru', 'sa_ar', 'sa_en', 'se', 'sg', 'si', 'sk', 'th_en', 'th_th', 'tr', 'tw', 'ua', 'uk', 'vn_en', 'vn_vi', 'za'];
(() => {
function buildLink(language, url) {
const link = document.createElement('link');
link.setAttribute('rel', 'alternate');
link.setAttribute('hreflang', language);
link.setAttribute('href', url);
return link;
}
async function fetchAndParseSitemap() {
const sitemapOrigin = 'https://www.adobe.com';
const { origin, pathname } = window.location;
let sitemapPath = '/cc-shared/assets/sitemap.xml';
const localeMatch = LOCALES.find(locale => pathname.startsWith(`/${locale}/`));
if (localeMatch) {
sitemapPath = `/${localeMatch}/cc-shared/assets/sitemap.xml`;
}
try {
const controller = new AbortController();
const timeoutId = setTimeout(() => controller.abort(), 5000);
let response;
try {
response = await fetch(`${origin}${sitemapPath}`, { signal: controller.signal });
} finally {
clearTimeout(timeoutId);
}
if (!response.ok) {
console.warn('Failed to fetch sitemap:', response.status);
return;
}
const xmlText = await response.text();
const parser = new DOMParser();
const xmlDoc = parser.parseFromString(xmlText, 'text/xml');
const parseError = xmlDoc.querySelector('parsererror');
if (parseError) {
return;
}
const urlElements = xmlDoc.querySelectorAll('url');
let currentUrlElement = null;
const correctedPath = pathname.endsWith('.html') ? pathname : `${pathname}.html`;
const isLocalRoot = localeMatch && `${sitemapOrigin}/${localeMatch}/` === `${sitemapOrigin}${pathname}`;
const rootPage = isLocalRoot ? `${sitemapOrigin}/${localeMatch}/` : `${sitemapOrigin}/`;
const currentPageUrl = pathname !== '/' && pathname !== `/${localeMatch}/` ? `${sitemapOrigin}${correctedPath}` : `${rootPage}`;
for (const urlElement of urlElements) {
const loc = urlElement.querySelector('loc')?.textContent;
if (loc === currentPageUrl || loc === currentPageUrl.replace(/\/$/, '')) {
currentUrlElement = urlElement;
break;
}
}
if (!currentUrlElement) {
console.warn('Current page not found in sitemap');
return;
}
const alternateLinks = currentUrlElement.querySelectorAll('link[rel="alternate"]');
const linkElements = [];
alternateLinks.forEach(altLink => {
const hreflang = altLink.getAttribute('hreflang');
const href = altLink.getAttribute('href');
if (hreflang && href) {
linkElements.push(buildLink(hreflang, href));
}
});
const titleElement = document.head.querySelector('title');
if (linkElements.length > 0 && titleElement) {
titleElement.after(...linkElements);
}
} catch (error) {
console.error('Error fetching or parsing sitemap:', error);
}
}
if (isAllowedAgent && !ssrFlag) {
fetchAndParseSitemap();
}
})();
const meta = document.createElement('meta');
meta.setAttribute('name', 'head-loaded');
document.head.append(meta);
import { scriptInit } from '/creativecloud/plans/scripts/utils.js';
scriptInit();
</script>
<link rel="icon" href="data:," />