Skip to content

Commit

Permalink
fix keywords in json-ld
Browse files Browse the repository at this point in the history
PDOK-16665
  • Loading branch information
roelarents committed Nov 4, 2024
1 parent 9559245 commit 70605d6
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
6 changes: 6 additions & 0 deletions cmd/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ func Test_newRouter(t *testing.T) {
apiCall: "http://localhost:8180/collections/NewYork?f=html",
wantBody: "internal/engine/testdata/expected_multiple_ogc_apis_single_collection.html",
},
{
name: "Serve JSON-LD in multiple OGC APIs for single collection in HTML",
configFile: "internal/engine/testdata/config_multiple_ogc_apis_single_collection.yaml",
apiCall: "http://localhost:8180/collections/NewYork?f=html",
wantBody: "internal/engine/testdata/expected_multiple_ogc_apis_single_collection_json_ld.html",
},
{
name: "Serve multiple Feature Tables from single GeoPackage",
configFile: "internal/ogc/features/testdata/config_features_bag_multiple_feature_tables.yaml",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<script type="application/ld+json">
{
"@context": "https://schema.org/",
"@type": "Dataset",
"isPartOf": "http:\/\/localhost:8180?f=html",
"name": "New York - NewYork",
"description": "This is a description about the NewYork collection in Markdown. We offer both 3D Tiles and Features for this collection.",
"url": "http:\/\/localhost:8180/collections/NewYork?f=html","keywords": ["Keyword1","Keyword2"],"license": "https:\/\/creativecommons.org\/publicdomain\/zero\/1.0\/deed.nl",
"isAccessibleForFree": true
,"thumbnailUrl": "http:\/\/localhost:8180/resources/3d.png"
,"version": "2023-05-10"
}
</script>
6 changes: 5 additions & 1 deletion internal/ogc/common/geospatial/templates/collection.go.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@
{{- end }}
"url": "{{ .Config.BaseURL }}/collections/{{ .Params.ID }}?f=html",
{{- if and .Params.Metadata .Params.Metadata.Keywords -}}
"keywords": ["{{ .Params.Metadata.Keywords | join ", " }}"],
"keywords": [
{{- range $i, $k := .Params.Metadata.Keywords -}}
{{- if $i -}},{{- end -}}"{{ $k }}"
{{- end -}}
],
{{- end -}}
"license": "{{ .Config.License.URL }}",
"isAccessibleForFree": true
Expand Down

0 comments on commit 70605d6

Please sign in to comment.