Skip to content

Commit

Permalink
feat: support extension in sitemap location
Browse files Browse the repository at this point in the history
  • Loading branch information
dominique-pfister committed Jun 5, 2024
1 parent 914459a commit ed2f2b8
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 5 deletions.
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@
"/en/{path}",
"/german/{path}"
]
},
"extension": {
"type": "string",
"title": "Location extension",
"description": "Extension to append to every location generated for this sitemap. Default is empty",
"examples": [
".html"
]
}
},
"required": [
Expand Down
8 changes: 8 additions & 0 deletions packages/helix-shared-config/src/schemas/sitemap.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@
"additionalProperties": {
"$ref": "https://ns.adobe.com/helix/shared/sitemap-language"
}
},
"extension": {
"type": "string",
"title": "Location extension",
"description": "Extension to append to every location generated for this sitemap. Default is empty",
"examples": [
".html"
]
}
},
"required": []
Expand Down
5 changes: 5 additions & 0 deletions packages/helix-shared-config/test/sitemapconfigs.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ const tests = [
config: 'simple.yaml',
result: 'simple.json',
},
{
title: 'loads a simple example with extension',
config: 'simple-extension.yaml',
result: 'simple-extension.json',
},
{
title: 'loads an example with multiple languages',
config: 'multilang.yaml',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"sitemaps": {
"multilang": {
"origin": "https://www.example.com",
"languages": {
"en": {
"source": "/en/query-index.json",
"destination": "/sitemap-en.xml",
"hreflang": "en"
},
"fr": {
"source": "/fr/query-index.json",
"destination": "/sitemap-fr.xml",
"hreflang": "fr",
"alternate": "/fr/{path}",
"extension": ".html"
},
"la": {
"source": "/la/query-index.json",
"destination": "/sitemap-la.xml",
"hreflang": ["es-VE","es-SV","es-PA"],
"alternate": "/la/{path}"
}
}
}
},
"version": 1
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: 1

sitemaps:
multilang:
origin: https://www.example.com
languages:
en:
source: /en/query-index.json
destination: /sitemap-en.xml
hreflang: en
fr:
source: /fr/query-index.json
destination: /sitemap-fr.xml
hreflang: fr
alternate: /fr/{path}
extension: .html
la:
source: /la/query-index.json
destination: /sitemap-la.xml
hreflang:
- es-VE
- es-SV
- es-PA
alternate: /la/{path}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"sitemaps": {
"simple": {
"origin": "https://www.example.com",
"source": "/query-index.json",
"destination": "/sitemap-en.xml",
"extension": ".html"
}
},
"version": 1
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 1

sitemaps:
simple:
origin: https://www.example.com
source: /query-index.json
destination: /sitemap-en.xml
extension: .html

0 comments on commit ed2f2b8

Please sign in to comment.