Skip to content

Commit 7d76cb8

Browse files
committed
Revert "[metadata] use https protocol for schema urls" (#81934)
1 parent f980400 commit 7d76cb8

File tree

6 files changed

+76
-76
lines changed

6 files changed

+76
-76
lines changed

packages/next/src/build/webpack/loaders/metadata/resolve-route-data.test.ts

Lines changed: 62 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,16 @@ describe('resolveRouteData', () => {
8787
},
8888
])
8989
).toMatchInlineSnapshot(`
90-
"<?xml version="1.0" encoding="UTF-8"?>
91-
<urlset xmlns="https://www.sitemaps.org/schemas/sitemap/0.9">
92-
<url>
93-
<loc>https://example.com</loc>
94-
<lastmod>2021-01-01</lastmod>
95-
<changefreq>weekly</changefreq>
96-
<priority>0.5</priority>
97-
</url>
98-
</urlset>
99-
"
90+
"<?xml version="1.0" encoding="UTF-8"?>
91+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
92+
<url>
93+
<loc>https://example.com</loc>
94+
<lastmod>2021-01-01</lastmod>
95+
<changefreq>weekly</changefreq>
96+
<priority>0.5</priority>
97+
</url>
98+
</urlset>
99+
"
100100
`)
101101
})
102102
it('should resolve sitemap.xml with alternates', () => {
@@ -114,16 +114,16 @@ describe('resolveRouteData', () => {
114114
},
115115
])
116116
).toMatchInlineSnapshot(`
117-
"<?xml version="1.0" encoding="UTF-8"?>
118-
<urlset xmlns="https://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="https://www.w3.org/1999/xhtml">
119-
<url>
120-
<loc>https://example.com</loc>
121-
<xhtml:link rel="alternate" hreflang="es" href="https://example.com/es" />
122-
<xhtml:link rel="alternate" hreflang="de" href="https://example.com/de" />
123-
<lastmod>2021-01-01</lastmod>
124-
</url>
125-
</urlset>
126-
"
117+
"<?xml version="1.0" encoding="UTF-8"?>
118+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">
119+
<url>
120+
<loc>https://example.com</loc>
121+
<xhtml:link rel="alternate" hreflang="es" href="https://example.com/es" />
122+
<xhtml:link rel="alternate" hreflang="de" href="https://example.com/de" />
123+
<lastmod>2021-01-01</lastmod>
124+
</url>
125+
</urlset>
126+
"
127127
`)
128128
})
129129
it('should resolve sitemap.xml with images', () => {
@@ -138,19 +138,19 @@ describe('resolveRouteData', () => {
138138
},
139139
])
140140
).toMatchInlineSnapshot(`
141-
"<?xml version="1.0" encoding="UTF-8"?>
142-
<urlset xmlns="https://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="https://www.google.com/schemas/sitemap-image/1.1">
143-
<url>
144-
<loc>https://example.com</loc>
145-
<image:image>
146-
<image:loc>https://example.com/image.jpg</image:loc>
147-
</image:image>
148-
<lastmod>2021-01-01</lastmod>
149-
<changefreq>weekly</changefreq>
150-
<priority>0.5</priority>
151-
</url>
152-
</urlset>
153-
"
141+
"<?xml version="1.0" encoding="UTF-8"?>
142+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">
143+
<url>
144+
<loc>https://example.com</loc>
145+
<image:image>
146+
<image:loc>https://example.com/image.jpg</image:loc>
147+
</image:image>
148+
<lastmod>2021-01-01</lastmod>
149+
<changefreq>weekly</changefreq>
150+
<priority>0.5</priority>
151+
</url>
152+
</urlset>
153+
"
154154
`)
155155
})
156156
it('should resolve sitemap.xml with videos', () => {
@@ -194,35 +194,35 @@ describe('resolveRouteData', () => {
194194
},
195195
])
196196
).toMatchInlineSnapshot(`
197-
"<?xml version="1.0" encoding="UTF-8"?>
198-
<urlset xmlns="https://www.sitemaps.org/schemas/sitemap/0.9" xmlns:video="https://www.google.com/schemas/sitemap-video/1.1">
199-
<url>
200-
<loc>https://example.com</loc>
201-
<video:video>
202-
<video:title>example</video:title>
203-
<video:thumbnail_loc>https://example.com/image.jpg</video:thumbnail_loc>
204-
<video:description>this is the description</video:description>
205-
<video:content_loc>http://streamserver.example.com/video123.mp4</video:content_loc>
206-
<video:player_loc>https://www.example.com/videoplayer.php?video=123</video:player_loc>
207-
<video:duration>2</video:duration>
208-
<video:view_count>50</video:view_count>
209-
<video:tag>summer</video:tag>
210-
<video:rating>4</video:rating>
211-
<video:expiration_date>2025-09-16</video:expiration_date>
212-
<video:publication_date>2024-09-16</video:publication_date>
213-
<video:family_friendly>yes</video:family_friendly>
214-
<video:requires_subscription>no</video:requires_subscription>
215-
<video:live>no</video:live>
216-
<video:restriction relationship="allow">IE GB US CA</video:restriction>
217-
<video:platform relationship="allow">web</video:platform>
218-
<video:uploader info="https://www.example.com/users/grillymcgrillerson">GrillyMcGrillerson</video:uploader>
219-
</video:video>
220-
<lastmod>2021-01-01</lastmod>
221-
<changefreq>weekly</changefreq>
222-
<priority>0.5</priority>
223-
</url>
224-
</urlset>
225-
"
197+
"<?xml version="1.0" encoding="UTF-8"?>
198+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
199+
<url>
200+
<loc>https://example.com</loc>
201+
<video:video>
202+
<video:title>example</video:title>
203+
<video:thumbnail_loc>https://example.com/image.jpg</video:thumbnail_loc>
204+
<video:description>this is the description</video:description>
205+
<video:content_loc>http://streamserver.example.com/video123.mp4</video:content_loc>
206+
<video:player_loc>https://www.example.com/videoplayer.php?video=123</video:player_loc>
207+
<video:duration>2</video:duration>
208+
<video:view_count>50</video:view_count>
209+
<video:tag>summer</video:tag>
210+
<video:rating>4</video:rating>
211+
<video:expiration_date>2025-09-16</video:expiration_date>
212+
<video:publication_date>2024-09-16</video:publication_date>
213+
<video:family_friendly>yes</video:family_friendly>
214+
<video:requires_subscription>no</video:requires_subscription>
215+
<video:live>no</video:live>
216+
<video:restriction relationship="allow">IE GB US CA</video:restriction>
217+
<video:platform relationship="allow">web</video:platform>
218+
<video:uploader info="https://www.example.com/users/grillymcgrillerson">GrillyMcGrillerson</video:uploader>
219+
</video:video>
220+
<lastmod>2021-01-01</lastmod>
221+
<changefreq>weekly</changefreq>
222+
<priority>0.5</priority>
223+
</url>
224+
</urlset>
225+
"
226226
`)
227227
})
228228
})

packages/next/src/build/webpack/loaders/metadata/resolve-route-data.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,15 @@ export function resolveSitemap(data: MetadataRoute.Sitemap): string {
5252

5353
let content = ''
5454
content += '<?xml version="1.0" encoding="UTF-8"?>\n'
55-
content += '<urlset xmlns="https://www.sitemaps.org/schemas/sitemap/0.9"'
55+
content += '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"'
5656
if (hasImages) {
57-
content += ' xmlns:image="https://www.google.com/schemas/sitemap-image/1.1"'
57+
content += ' xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"'
5858
}
5959
if (hasVideos) {
60-
content += ' xmlns:video="https://www.google.com/schemas/sitemap-video/1.1"'
60+
content += ' xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"'
6161
}
6262
if (hasAlternates) {
63-
content += ' xmlns:xhtml="https://www.w3.org/1999/xhtml">\n'
63+
content += ' xmlns:xhtml="http://www.w3.org/1999/xhtml">\n'
6464
} else {
6565
content += '>\n'
6666
}

test/e2e/app-dir/metadata-dynamic-routes/index.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ describe('app dir - metadata dynamic routes', () => {
5252

5353
expect(text).toMatchInlineSnapshot(`
5454
"<?xml version="1.0" encoding="UTF-8"?>
55-
<urlset xmlns="https://www.sitemaps.org/schemas/sitemap/0.9">
55+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
5656
<url>
5757
<loc>https://example.com</loc>
5858
<lastmod>2021-01-01</lastmod>
@@ -95,7 +95,7 @@ describe('app dir - metadata dynamic routes', () => {
9595
it('should support alternate.languages in sitemap', async () => {
9696
const xml = await (await next.fetch('/lang/sitemap.xml')).text()
9797

98-
expect(xml).toContain('xmlns:xhtml="https://www.w3.org/1999/xhtml')
98+
expect(xml).toContain('xmlns:xhtml="http://www.w3.org/1999/xhtml')
9999
expect(xml).toContain(
100100
`<xhtml:link rel="alternate" hreflang="es" href="https://example.com/es/about" />`
101101
)
@@ -119,7 +119,7 @@ describe('app dir - metadata dynamic routes', () => {
119119
const xml = await (await next.fetch('/sitemap-video/sitemap.xml')).text()
120120
expect(xml).toMatchInlineSnapshot(`
121121
"<?xml version="1.0" encoding="UTF-8"?>
122-
<urlset xmlns="https://www.sitemaps.org/schemas/sitemap/0.9" xmlns:video="https://www.google.com/schemas/sitemap-video/1.1">
122+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
123123
<url>
124124
<loc>https://example.com/about</loc>
125125
<video:video>

test/e2e/app-dir/middleware-sitemap/matcher-exclude-sitemap/index.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ describe('middleware-sitemap', () => {
66
})
77

88
it('should not be affected by middleware if sitemap.xml is excluded from the matcher', async () => {
9-
let html = await next.render('/')
9+
const html = await next.render('/')
1010
expect(html).toContain('redirected')
1111

1212
const xml = await next.render('/sitemap.xml')
1313
expect(xml).toMatchInlineSnapshot(`
1414
"<?xml version="1.0" encoding="UTF-8"?>
15-
<urlset xmlns="https://www.sitemaps.org/schemas/sitemap/0.9">
15+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
1616
<url>
1717
<loc>https://vercel.com</loc>
1818
<lastmod>2023-10-01</lastmod>

test/e2e/app-dir/sitemap-group/sitemap-group.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ describe('sitemap-group', () => {
1212
const text = await res.text()
1313
expect(text).toMatchInlineSnapshot(`
1414
"<?xml version="1.0" encoding="UTF-8"?>
15-
<urlset xmlns="https://www.sitemaps.org/schemas/sitemap/0.9">
15+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
1616
<url>
1717
<loc>https://www.vercel.com</loc>
1818
<lastmod>2024-12-05T23:45:13.405Z</lastmod>

test/e2e/app-dir/use-cache-metadata-route-handler/use-cache-metadata-route-handler.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ describe('use-cache-metadata-route-handler', () => {
4444
if (isNextDev) {
4545
expect(body).toMatchInlineSnapshot(`
4646
"<?xml version="1.0" encoding="UTF-8"?>
47-
<urlset xmlns="https://www.sitemaps.org/schemas/sitemap/0.9">
47+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
4848
<url>
4949
<loc>https://acme.com?sentinel=runtime</loc>
5050
</url>
@@ -54,7 +54,7 @@ describe('use-cache-metadata-route-handler', () => {
5454
} else {
5555
expect(body).toMatchInlineSnapshot(`
5656
"<?xml version="1.0" encoding="UTF-8"?>
57-
<urlset xmlns="https://www.sitemaps.org/schemas/sitemap/0.9">
57+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
5858
<url>
5959
<loc>https://acme.com?sentinel=buildtime</loc>
6060
</url>
@@ -74,7 +74,7 @@ describe('use-cache-metadata-route-handler', () => {
7474
if (isNextDev) {
7575
expect(body).toMatchInlineSnapshot(`
7676
"<?xml version="1.0" encoding="UTF-8"?>
77-
<urlset xmlns="https://www.sitemaps.org/schemas/sitemap/0.9">
77+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
7878
<url>
7979
<loc>https://acme.com/1?sentinel=runtime</loc>
8080
</url>
@@ -84,7 +84,7 @@ describe('use-cache-metadata-route-handler', () => {
8484
} else {
8585
expect(body).toMatchInlineSnapshot(`
8686
"<?xml version="1.0" encoding="UTF-8"?>
87-
<urlset xmlns="https://www.sitemaps.org/schemas/sitemap/0.9">
87+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
8888
<url>
8989
<loc>https://acme.com/1?sentinel=buildtime</loc>
9090
</url>

0 commit comments

Comments
 (0)